-
Notifications
You must be signed in to change notification settings - Fork 415
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 for supplying POST, DELETE and PUT parameters in the HTTP request body instead of GET parameters #33
Conversation
…ody instead of GET parameters
I also added a support for EnumeratedDescription which enables a better way to describe enumerated field values. It renders the possible enumerated field values with descriptions as a definition list below the field description. |
|
||
35. "Type" key value is *boolean* that will render a drop-down (select box) on the form for *true* and *false*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 35 seemed like a typo in the readme.
+1, I hope this gets merged in. |
It would also be useful to set the content type of POST and PUT bodies for APIs that only handle XML content. |
I'm going to merge this in. I think a fast follow to this might be JSON encoding (JSON.stringify) with application/json content-type, eh? Thanks for your work on this. Love it. |
Support for supplying POST, DELETE and PUT parameters in the HTTP request body instead of GET parameters; enumerated descriptions feature.
}; | ||
|
||
if (['POST','DELETE','PUT'].indexOf(httpMethod) !== -1) { | ||
var requestBody = query.stringify(params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone is looking for using a body in JSON format, this needs to be changed to JSON.stringify(params);
query.stringify(params) will return something like
value=someval
JSON.stringift(params) will return
{"value":"someval"}
Otherwise, you'll throw a parse error on the server-side which is expecting a JSON format.
I've implemented support for POST, DELETE and PUT request parameters as part of HTTP request body instead of supplying them as GET parameters.
Previously, for example, when supplying parameters for a POST request, these parameters got attached to the request as GET parameters not as part of the request body as per HTTP specification. This patch addresses this issue.
EDIT: I also added a support for EnumeratedDescription which enables a better way to describe enumerated field values. It renders the possible enumerated field values with descriptions as a definition list below the field description.
Please review and discuss, hope it finds good use :)