Changeset 17197 in josm for trunk/test/functional/org/openstreetmap/josm/tools
- Timestamp:
- 2020-10-13T23:48:18+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
r17154 r17197 339 339 @Test 340 340 public void testOpenUrlGzip() throws IOException { 341 final URL url = new URL("https://www.openstreetmap.org/trace/1613906/data"); 341 final byte[] gpx = Utils.readBytesFromStream(getClass().getClassLoader().getResourceAsStream("tracks/tracks.gpx.gz")); 342 localServer.stubFor(get(urlEqualTo("/trace/1613906/data")) 343 .willReturn(aResponse() 344 .withStatus(200) 345 .withHeader("content-type", "application/x-gzip") 346 .withBody(gpx))); 347 348 final URL url = new URL(localServer.url("/trace/1613906/data")); 342 349 try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) { 343 350 Assert.assertTrue(x.readLine().startsWith("<?xml version=")); … … 351 358 @Test 352 359 public void testOpenUrlBzip() throws IOException { 353 final URL url = new URL("https://www.openstreetmap.org/trace/785544/data"); 360 final byte[] gpx = Utils.readBytesFromStream(getClass().getClassLoader().getResourceAsStream("tracks/tracks.gpx.bz2")); 361 localServer.stubFor(get(urlEqualTo("/trace/785544/data")) 362 .willReturn(aResponse() 363 .withStatus(200) 364 .withHeader("content-type", "application/x-bzip2") 365 .withBody(gpx))); 366 367 final URL url = new URL(localServer.url("/trace/785544/data")); 354 368 try (BufferedReader x = HttpClient.create(url).connect().uncompress(true).getContentReader()) { 355 369 Assert.assertTrue(x.readLine().startsWith("<?xml version=")); … … 362 376 */ 363 377 @Test 364 public void testTicket9660() throws IOException { 365 final URL url = new URL("http://www.openstreetmap.org/trace/1350010/data"); 378 public void testOpenUrlBzipAccordingToContentDisposition() throws IOException { 379 final byte[] gpx = Utils.readBytesFromStream(getClass().getClassLoader().getResourceAsStream("tracks/tracks.gpx.bz2")); 380 localServer.stubFor(get(urlEqualTo("/trace/1350010/data")) 381 .willReturn(aResponse() 382 .withStatus(200) 383 .withHeader("content-type", "application/octet-stream") 384 .withHeader("content-disposition", "attachment; filename=\"1350010.gpx.bz2\"") 385 .withBody(gpx))); 386 387 final URL url = new URL(localServer.url("/trace/1350010/data")); 366 388 try (BufferedReader x = HttpClient.create(url).connect() 367 389 .uncompress(true).uncompressAccordingToContentDisposition(true).getContentReader()) {
Note:
See TracChangeset
for help on using the changeset viewer.