{"record":{"id":"47537cbb6818b098","repo":"transloadit/uppy","slug":"unsupported-http-method-specified","errorCode":null,"errorMessage":"unsupported HTTP METHOD specified","messagePattern":"unsupported HTTP METHOD specified","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/@uppy/companion/src/server/Uploader.ts","lineNumber":112,"sourceCode":"  extraData?: UploadExtraData | undefined\n}\n\nfunction exceedsMaxFileSize(\n  maxFileSize: number | undefined,\n  size: number | undefined,\n): boolean {\n  return maxFileSize !== undefined && size !== undefined && size > maxFileSize\n}\n\nexport class ValidationError extends Error {\n  override name = 'ValidationError'\n}\n\nfunction validateOptions(options: UploaderOptions): void {\n  // validate HTTP Method (optional)\n  if (options.httpMethod) {\n    if (typeof options.httpMethod !== 'string') {\n      throw new ValidationError('unsupported HTTP METHOD specified')\n    }\n\n    const method = options.httpMethod.toUpperCase()\n    if (method !== 'PUT' && method !== 'POST') {\n      throw new ValidationError('unsupported HTTP METHOD specified')\n    }\n  }\n\n  if (exceedsMaxFileSize(options.companionOptions.maxFileSize, options.size)) {\n    throw new ValidationError('maxFileSize exceeded')\n  }\n\n  // validate fieldname (optional)\n  if (options.fieldname != null && typeof options.fieldname !== 'string') {\n    throw new ValidationError('fieldname must be a string')\n  }\n\n  // validate metadata (optional)","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/companion/src/server/Uploader.ts#L94-L130","documentation":"Uploader.validateOptions checks the optional httpMethod and rejects it when it's not a string. Only 'PUT' and 'POST' (case-insensitive) are supported for uploading files to a destination URL.","triggerScenarios":"Constructing new Uploader({ httpMethod: 123 }) or any non-string value (null is treated as 'not provided' only when omitted; a provided non-string throws).","commonSituations":"Passing method from untyped request bodies or env vars that end up as numbers/objects; typos in config files.","solutions":["Pass httpMethod as a string: 'PUT' or 'POST'","Omit httpMethod entirely to use the default","Validate/coerce user-supplied methods before constructing Uploader"],"exampleFix":"// before\nnew Uploader({ httpMethod: 123, ... })\n\n// after\nnew Uploader({ httpMethod: 'PUT', ... })","handlingStrategy":"type-guard","validationCode":"if (httpMethod != null && typeof httpMethod !== 'string') throw new TypeError('httpMethod must be a string')","typeGuard":"const isMethod = (m: unknown): m is string => typeof m === 'string' && ['PUT', 'POST'].includes(m.toUpperCase())","tryCatchPattern":"null","preventionTips":["Coerce untyped method input to string and validate against PUT/POST"],"tags":["companion","uploader","validation","http-method"],"backgroundTag":"invalid-option-type","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}