Revert "Infer HTTP 404 from empty Optional/Publisher types"

This reverts commit 7e91733502.
This commit is contained in:
Brian Clozel
2018-08-15 15:15:35 +02:00
parent 1b54d2119d
commit f2506ca7a1
6 changed files with 86 additions and 155 deletions

View File

@@ -350,20 +350,6 @@ public class ResponseEntityResultHandlerTests {
assertResponseBodyIsEmpty(exchange);
}
@Test // SPR-13281
public void handleEmptyMonoShouldResultInNotFoundStatus() {
MockServerWebExchange exchange = MockServerWebExchange.from(get("/path"));
exchange.getAttributes().put(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, Collections.singleton(APPLICATION_JSON));
MethodParameter type = on(TestController.class).resolveReturnType(Mono.class, ResponseEntity.class);
HandlerResult result = new HandlerResult(new TestController(), Mono.empty(), type);
this.resultHandler.handleResult(exchange, result).block(Duration.ofSeconds(5));
assertEquals(HttpStatus.NOT_FOUND, exchange.getResponse().getStatusCode());
assertResponseBodyIsEmpty(exchange);
}
private void testHandle(Object returnValue, MethodParameter returnType) {