-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow multiple -data parameters #1
Comments
The curl manpage also says that the content-type header should be transformed to application/x-www-form-urlencoded. Do you agree ? |
Good point. This might be where we diverge from curl(1), as the internal usage which JCurl sprang from is more geared towards multipart/form-data than application/x-www-for-urlencoded. Generally, I'd like to keep JCurl liberal wrt. parameter syntax - just pass in whatever you want and have the API you call tell you if you're doing something stupid. But let me come back to you with a full response when I implement it (or see a PR). |
I see that the multipart/form-data case is implemented (formMap). It may exists two options to deal with application/x-www-form-urlencoded :
Whatever the chosen option we'll need to add an example in the documentation. |
Should have said it earlier, but thanks for your comments! Great to see the tool being used by someone else than myself:). As to your suggestion, there's also application/json, which has been the main concern for this tool and is another major use case for -d. Thus, setting the content type to form-urlencoded automatically would be too limiting. However if the content type is urlencoded, then yes, we can definitely concat multiple -d values with &. In general, my goal would be to keep the parameter syntax as close as possible to curl(1), but not fanatically, diverging from it when I see curl too limiting or when we can provide syntax sugar that curl doesn't. |
For compatibility with curl(1), allow specifying the -d | -data parameter more than once.
Form curl manpage:
The text was updated successfully, but these errors were encountered: