Polish byte-range resource handling

This commit is contained in:
Brian Clozel
2016-09-20 23:46:21 +02:00
parent 129d7bef6e
commit 578af59f0c
4 changed files with 34 additions and 29 deletions

View File

@@ -525,10 +525,10 @@ public class ResourceWebHandlerTests {
this.request.addHeader("Range", "bytes= foo bar");
this.exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "foo.txt");
TestSubscriber.subscribe(this.handler.handle(this.exchange))
.assertErrorWith(throwable -> {
assertThat(throwable, instanceOf(IllegalArgumentException.class));
});
TestSubscriber.subscribe(this.handler.handle(this.exchange)).assertComplete();
assertEquals(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE, this.response.getStatusCode());
assertEquals("bytes", this.response.getHeaders().getFirst("Accept-Ranges"));
}
@Test