Hi, I believe that there is a bug in the org.apache.hc.core5.net.URIBuilder class, it is not converting + characters to spaces. This is working in org.apache.http.client.utils.URIBuilder.
Example: @Test fun testParseHC5() { val uri = org.apache.hc.core5.net.URIBuilder("https://example.com/?value=foo+bar”) assertEquals("https://example.com/?value=foo+bar", uri.build().toString()) assertEquals("value", uri.queryParams[0].name) assertEquals("foo bar", uri.queryParams[0].value) // <— This assertion fails } @Test fun testParseHC4() { val uri = org.apache.http.client.utils.URIBuilder("https://example.com/?value=foo+bar”) assertEquals("https://example.com/?value=foo+bar", uri.build().toString()) assertEquals("value", uri.queryParams[0].name) assertEquals("foo bar", uri.queryParams[0].value) } The first test using HttpClient 5 fails, the parameter value is “foo+bar” instead of “foo bar”. The second test using HttpClient 4 works. As far as I understand, + characters in the query string are representing spaces: - https://www.w3.org/Addressing/URL/4_URI_Recommentations.html - https://www.w3.org/TR/html401/interact/forms.html#form-content-type I believe this is where the code is that tells the parser to keep + characters: - https://github.com/apache/httpcomponents-core/blob/9f8cdb17c85defb267fc814d6094bfda3c8ff1a7/httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java#L410 / Johan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org