Bug in URL constructor: query parameters without values are not captured

Reproduction:

URL url1("https://juce.com/?foobar");
jassert(url1.toString(true) == "https://juce.com/?foobar"); // toString(true) just returns "https://juce.com/"

RFC 3986, section 3.4 specifies the query part starting at the first “?” just as “non-hierarchical data”. So I think it’s fair to expect toString(true) to return the original URL including the get parameter without value.

for clarification, the following DOES yield the expected result:

URL url1("https://juce.com/?foobar=1");
jassert(url1.toString(true) == "https://juce.com/?foobar=1"); // toString(true) works fine if the query string is formatted as ?k0=v0&k1=v1&k2=v2...

thanks,
Ben

OS: macOS 10.12.5, JUCE version: latest master

1 Like

Thanks, I’ve just pushed a fix for this to develop.

thanks!