# URL class, POST broken in latest develop

**URL:** <https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970>\
**Category:** General JUCE discussion\
**Created:** [March 12, 2021, 7:59pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970 "2021-03-12T19:59:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)\
**Post date:** [March 12, 2021, 7:59pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/1 "2021-03-12T19:59:01Z")

</div>

Develop tip, there’s either a bug or a breaking change for URLs with POST data.

We have been creating our URLs like this for years:

```
URL theURL = URL (url).withParameter ("paramName", "paramValue");
std::unique_ptr<InputStream> input (theURL.createInputStream (true));

```

Now no data is passing through neither as POST nor as GET.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [March 12, 2021, 8:29pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/2 "2021-03-12T20:29:11Z")

</div>

Does the URL object contain any POST data added with the withPOSTData() methods or are you just trying to send the parameters in the request body as a POST request?

---

<div class="post-metadata">

**Author:** ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)\
**Post date:** [March 12, 2021, 8:41pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/3 "2021-03-12T20:41:00Z")

</div>

Never used withPOSTData, I’ll have a look, but as I wrote, we have always just used withParameter and never had issues until the latest commits.  
The description of withParameter is

> Returns a copy of this URL, with a GET or POST parameter added to the end.

Passing true to createInputStream should be more than enough.

> doPostLikeRequest if true, the parameters added to this class will be transferred via the HTTP headers which is typical for POST requests. Otherwise the parameters will be added to the URL address. Additionally, if the parameter httpRequestCmd is not specified (or empty) then this parameter will determine which HTTP request command will be used (POST or GET).

---

<div class="post-metadata">

**Author:** ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)\
**Post date:** [March 12, 2021, 9:00pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/4 "2021-03-12T21:00:38Z")

</div>

Ok, using withPOSTData works. Still, I think this is a breaking change/bug that should be addressed.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [March 12, 2021, 9:07pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/5 "2021-03-12T21:07:13Z")

</div>

Yeah we’ll take a look, was just useful to narrow it down as I think I know what’s going on now. Thanks

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [March 13, 2021, 2:29pm UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/6 "2021-03-13T14:29:13Z")

</div>

doPostLikeRequest will urlencode the parameters in the post data, prior to the post data (if defined, potentially breaking it). By RFC, doing that will also require to have a content type of application/x-www-form-urlencoded in order to tell the receiver that the post data will contain urlencoded parameters (which, if also contains some other non urlencoded, non key value string after it, the body will be invalid)

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [March 15, 2021, 10:30am UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/7 "2021-03-15T10:30:11Z")

</div>

This should now be fixed on `develop`:

> <https://github.com/juce-framework/JUCE/commit/77d4ac7242296aaddee18f9da5a4fa7a3e3041c5>

---

<div class="post-metadata">

**Author:** ![audiothing](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/audiothing/32/8906_2.png) [@audiothing](https://forum.juce.com/u/audiothing)\
**Post date:** [March 15, 2021, 11:24am UTC](https://forum.juce.com/t/url-class-post-broken-in-latest-develop/44970/8 "2021-03-15T11:24:58Z")

</div>

Thank you!
