Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot send multipart/form-data after upgrade to 19.x #4042

Closed
phattranky opened this issue Feb 6, 2020 · 3 comments
Closed

Cannot send multipart/form-data after upgrade to 19.x #4042

phattranky opened this issue Feb 6, 2020 · 3 comments
Assignees
Labels
support Questions, discussions, and general support

Comments

@phattranky
Copy link

Support plan

  • which support plan is this issue covered by? Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 12.13.1
  • module version with issue: ^19.0.5
  • last module version without issue: ^18.3.1
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

I use the same code for both versions. But the 19.x always response error 415 - Unspported media type . It's working well on 18.x

{
          method: 'PUT',
          path: '/api/me/avatar',
          options: {
            handler: controller.updateAvatar,
            description: 'Update user avatar',
            tags: ['api', 'update user avatar'],
          },
        },

Here is the sample postman cUrl

curl -X PUT \
  http://localhost:3400/api/me/avatar \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 162' \
  -H 'Content-Type: multipart/form-data; boundary=--------------------------762515554275272587725335' \
  -H 'Host: localhost:3400' \
  -H 'Postman-Token: f6f33e9d-75fa-4b60-acfb-78f23174ad50,47fb7c5c-228f-4c3d-8112-c3f99af90489' \
  -H 'User-Agent: PostmanRuntime/7.20.1' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F dsss=sss

What was the result you got?

Error: 415 - Unsupported Media Type

What result did you expect?

200 OK

@Marsup
Copy link
Contributor

Marsup commented Feb 6, 2020

Reading the release notes can actually help sometimes.

@Marsup Marsup closed this as completed Feb 6, 2020
@Marsup Marsup self-assigned this Feb 6, 2020
@jonnycook
Copy link

Why would this make this change? That's just annoying.

@Marsup
Copy link
Contributor

Marsup commented May 27, 2020

Because routes accepting multipart are nowadays the exception, not the norm, and accepting it on all the routes can lead to some problems when you're not expecting it. Anyway it's not that hard to reenable it, it's just a default, but I would advise against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

3 participants