-
Notifications
You must be signed in to change notification settings - Fork 116
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
Raw body #108
Comments
After some further testing this may be an issue in iron:router or possibly even node? |
What version of restivus are you using? Iron Router was removed in 0.8.0. I think this is related to the Connect BodyParser middleware (which both iron router and the replacement router use for parsing request bodies). I'm on vacation and don't have time to look into this right now, but I would start there. I may be wrong, but the issue sounds like it's with the curl request. Why is it sending json data but not specifying the content type? Anyone constructing curl requests should understand the content type of the data they are trying to send. The body parser in connect checks the content type and decodes the data accordingly. My best guess is that there week be no way to alter this behavior. From what it sound like, the curl request wouldn't work with any API, not just a Restivus API. |
Thank you for looking into this while on vacation. It's not mission critical as we have fixed the curl request output from the source. But it's still would be nice to have a raw body report for debugging / resilience, but it would be just that, nice to have. In my limited experience the Slim rest framework for php they give you access to the raw body. This is actually the source of the problem... the original source code was dependent on there being a raw body option. But please, I hope you don't read this until you get back from vacation, if not have a great vacation! |
@robomatic , I'm trying to access the raw body of a request. In my case, the raw body is an xml format text. And I found this may help: action() {
let data = this.bodyParams // parsed params
let urlParams = this.queryParams // parsed get quries
let readable = this.request
let xml=readable._readableState.buffer.toString('utf8') // this would return you the raw body
console.log(xml)
// your other code here...
// return .....
} It works for meteor 1.5 and restivus 0.8.12 |
@kahmali Sorry, is there any way to get a raw body? |
Hi @dkudrin , have you found any workaround to get raw body data? |
I'm wondering how to get the raw body (data) from the request. It seems currently these are decoded by restivus based on content types. I'm running into a situation where the curl request does not specify the content type but provides JSON data that, I assume, gets decoded by restivus since the curl is sending a default post header content type of 'application/x-www-form-urlencoded'.
The text was updated successfully, but these errors were encountered: