Changeset 15968 in josm for trunk/test/functional/org/openstreetmap/josm
- Timestamp:
- 2020-03-01T01:02:22+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
r15742 r15968 85 85 assertThat(client.getURL(), is(new URL("https://httpbin.org/"))); 86 86 assertThat(client.getRequestMethod(), is("GET")); 87 assertThat(client.getRequestHeader("Accept"), nullValue());87 assertThat(client.getRequestHeader("Accept"), is("*/*")); 88 88 client.setAccept("text/html"); 89 89 assertThat(client.getRequestHeader("Accept"), is("text/html")); … … 119 119 assertThat(root.getJsonObject("headers").get("Cache-Control"), nullValue()); 120 120 assertThat(root.getJsonObject("headers").get("Pragma"), nullValue()); 121 } 122 } 123 124 /** 125 * Test JOSM User-Agent 126 * @throws IOException if an I/O error occurs 127 */ 128 @Test 129 public void testHeaders() throws IOException { 130 try (InputStream in = HttpClient.create(new URL("https://httpbin.org/headers")).connect(progress).getContent(); 131 JsonReader json = JsonProvider.provider().createReader(in)) { 132 final JsonObject headers = json.readObject().getJsonObject("headers"); 133 assertThat(headers.getString("Accept"), is("*/*")); 134 assertThat(headers.getString("Accept-Encoding"), is("gzip, deflate")); 135 assertThat(headers.getString("User-Agent"), is(Version.getInstance().getFullAgentString())); 121 136 } 122 137 }
Note:
See TracChangeset
for help on using the changeset viewer.