hgoebl / DavidWebb

Lightweight Java HTTP-Client for calling JSON REST-Services (especially for Android)
https://hgoebl.github.io/DavidWebb/
MIT License
127 stars 41 forks source link

cannot add query parameters to put request #30

Open svrolanski opened 6 years ago

svrolanski commented 6 years ago

When you use put(), calls to param() are ignored.

arbor95 commented 6 years ago

you can use uri += "?" + WebbUtils.queryString(request.params)

svrolanski commented 6 years ago

yes, that is a valid wordaround for it, I think that was what I used, but it is will a bug isn't?

arbor95 commented 6 years ago

I think you can have a body for put() (same as for post()), where the params go automatically (but I don't know if that is true. For get() you surely have no request body, so params go auto to the queryString of url.).

hgoebl commented 6 years ago

I'm not sure. Having query-params in URL of POST or PUT request can be useful, but AFAIK there are backend stacks which don't support it. At least for application/x-www-form-urlencoded it can be ambiguous.

Does anybody know facts about this?

svrolanski commented 6 years ago

After some quick reading, it does not seem to break any RFC and I agree with what one said: "The difference between /user/john and /?user=john is merely a semantic one".

https://stackoverflow.com/questions/611906/http-post-with-url-query-parameters-good-idea-or-not

https://stackoverflow.com/questions/14551194/how-are-parameters-sent-in-an-http-post-request/26717908#26717908