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

"Invalid Content-Type application/xml" thrown when posting xml data #1488

Closed
lovasoa opened this issue May 18, 2021 · 1 comment
Closed

"Invalid Content-Type application/xml" thrown when posting xml data #1488

lovasoa opened this issue May 18, 2021 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@lovasoa
Copy link
Contributor

lovasoa commented May 18, 2021

Describe the bug
When posting data with the content-type application/xml, SvelteKit throws an error.

Logs

Invalid Content-Type application/xml

To Reproduce

In the default sveltekit app, run npm run dev, then, from a terminal :

curl localhost:3000/xxx --header "Content-Type: application/xml" -v --data '<x></x>'

Expected behavior
A 404 error

Actual behavior
A 500 error

$ curl localhost:3000/xxx --header "Content-Type: application/xml" -v --data '<x></x>'
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 3000 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3000 (#0)
> POST /xxx HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/xml
> Content-Length: 7
> 
* upload completely sent off: 7 out of 7 bytes
< HTTP/1.1 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Date: Tue, 18 May 2021 19:44:40 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< 
Error: Invalid Content-Type application/xml
    at parse_body (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/ssr.js:1402:11)
    at respond (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/ssr.js:1514:11)
    at Immediate.<anonymous> (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/chunks/index.js:3305:29)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)* Closing connection 0
* Connection #0 to host localhost left intact

Stacktraces

Stack trace
Error: Invalid Content-Type application/xml
    at parse_body (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/ssr.js:1402:11)
    at respond (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/ssr.js:1514:11)
    at Immediate.<anonymous> (file:///Users/olojkine/Developpement/sanipasse/node_modules/@sveltejs/kit/dist/chunks/index.js:3305:29)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Information about your SvelteKit Installation:

Diagnostics

  System:
    OS: macOS 11.2.2
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 292.30 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.1.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.11.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 90.0.4430.212
    Firefox: 88.0.1
    Safari: 14.0.3
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.107 
    svelte: ^3.34.0 => 3.38.2 

Severity
Just annoying for me, blocking for anyone who wants to migrate an api that accepts xml to sveltekit.

Additional context

This bug was already reported in #852, which contained enough information for reproduction, but was closed without investigation.

@benmccann benmccann added the bug Something isn't working label May 19, 2021
@benmccann benmccann added this to the 1.0 milestone May 19, 2021
@benmccann
Copy link
Member

I believe this has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants