Can URL parameter encoding be independent of the inclusion of postData?


#1

So JUCE URL currently allows an input stream to be created with a boolean setting for whether to use a POST or a GET. If you use a GET, the parameters get included in the query string (?x=2 etc.) and if you use a POST, they get included in the body along with the post data.

I need to send a PUT request, wherein I have post data to send, but the parameters need to be in the query string like a GET. Is there any way to do this as-is? postData set in the URL isn’t included if I set the boolean to GET mode, even if I change the request command to something other than GET.

If not doable now, could this be patched in if we develop it here and submit code for it?


#2

The last parameter of URL::createInputStream allows you to specify which http command to use. You can also then specify if the command should be executed with post data or not (by setting doPostLikeRequest to true). You can also just add extra get parameters by just pretending they are part of the URL subpath.


#3

Would it work if doPostLikeRequest became usePostStyleParameters and if data was appended in get style requests? That way this use case is supported as far as I understand.


#4

Your use case is currently already supported. When doPostLikeRequest is true it will simply send any postData as post data in your request - you can still specify which http command you want to use and you can still add extra get parameters to the URL.