-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support \t in Content-Type header #808
Comments
I've tested with req.get('content-type').includes('application/soap xml') but doesn't work. |
Hi Alvaro. I understand you were able to replicate the issue with a test, or something like the snippet: export TAB=$'\t'
curl -H "Content-Type: application/soap xml;${TAB}charset=utf-8" "http://<iota json ip>:7897/iot/json/attrs/payload?i=<deviceid>&k=<apikey>" -d '<?xml version="1.0"?><body><attrib>value</attrib></body>" But changing I am working in a forked branch, and found some other changes are needed too. Let me open a PR so we can discuss the details more easily. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IoT Agent JSON version the issue has been seen with
3.1.0
Bound or port used (API interaction)
Southbound (Devices data API)
NGSI version
NGSIv2
Are you running a container?
Yes, I am using a contaner (Docker, Kubernetes...)
Image type
normal
Expected behaviour you didn't see
This is a follow-up to issue #759. The XML service integration still fails because the client includes a
"\t"
character in the Content-Type header.When sending a measure with content-type
"application/soap xml;\tcharset=utf-8"
to/iot/json/attrs/<name of attrib>
, the request should be accepted according to #771Unexpected behaviour you saw
The IoT Agent replies inmediately with "400 Bad Content".
This is because the
type-is
module, used internally by express, fails to match this content-type toapplication/soap xml
:This causes the following checks to fail:
iotagent-json/lib/bindings/HTTPBinding.js
Lines 75 to 83 in db40299
iotagent-json/lib/bindings/HTTPBinding.js
Lines 109 to 115 in db40299
And also an internal test in the
bodyparser-xml
dependency, which performs its own content-type check, matching to['*/xml', ' xml']
by default:Removing the
\t
makestype-is
recognize the content-type properly:I did open an issue upstream: jshttp/type-is#52
But I don't expect a fix to reach express anytime soon, so maybe we would need a workaround.
Steps to reproduce the problem
Configs
Log output
The text was updated successfully, but these errors were encountered: