This repository was archived by the owner on Apr 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/org/opendatakit/briefcase/reused/http
test/java/org/opendatakit/briefcase/reused/http Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public RequestMethod getMethod() {
8383 // TODO v2.0 Move this to RequestBuilder, with uri() and isUri()
8484 URI asUri () {
8585 try {
86- return url .toURI ( );
86+ return new URI ( url .toString (). replaceAll ( " " , "%20" ) );
8787 } catch (URISyntaxException e ) {
8888 throw new BriefcaseException (e );
8989 }
Original file line number Diff line number Diff line change 1717package org .opendatakit .briefcase .reused .http ;
1818
1919import static java .nio .charset .StandardCharsets .UTF_8 ;
20+ import static org .hamcrest .Matchers .containsString ;
2021import static org .hamcrest .Matchers .instanceOf ;
2122import static org .hamcrest .Matchers .is ;
23+ import static org .hamcrest .Matchers .not ;
2224import static org .junit .Assert .assertThat ;
2325
2426import java .io .ByteArrayInputStream ;
2830public class RequestTest {
2931
3032 private static final String BASE_URL = "http://foo.com" ;
33+ private static final String URL_WITH_SPACE = "http://foo.com/some spaces are here" ;
3134
3235 @ Test
3336 public void can_map_a_response_body () {
@@ -40,4 +43,10 @@ public void can_map_a_response_body() {
4043 public void can_return_its_uri () {
4144 assertThat (RequestBuilder .get (BASE_URL ).build ().asUri (), instanceOf (URI .class ));
4245 }
46+
47+ @ Test
48+ public void can_return_its_uri_with_encoded_spaces () {
49+ assertThat (RequestBuilder .get (URL_WITH_SPACE ).build ().asUri (), instanceOf (URI .class ));
50+ assertThat (RequestBuilder .get (URL_WITH_SPACE ).build ().asUri ().toString (), not (containsString (" " )));
51+ }
4352}
You can’t perform that action at this time.
0 commit comments