I generated POST method from openapi and if I try to send a request with body "null" I get the following response:
HTTP/1.1 400 Bad Request
Connection: keep-alive
Server: kora/undertow
Content-Length: 4
Content-Type: text/plain; charset=utf-8
Date: Wed, 21 Jun 2023 07:21:42 GMT
data
I've already investigated and figured out that such strange answer is caused by NPE in ru.tinkoff.kora.json.module.http.server.JsonReaderHttpServerRequestMapper<T>:22:
@Override
public Mono<T> apply(HttpServerRequest request) {
return ReactorUtils.toByteArrayMono(request.body())
.handle((bytes, sink) -> {
try {
sink.next(this.reader.read(bytes)); // <-- NPE HERE
} catch (Exception e) {
var httpException = HttpServerResponseException.of(e, 400, e.getMessage());
sink.error(httpException);
}
});
}
Text "data" came from HandleFuseableConditionalSubscriber#next:
data = Objects.requireNonNull(o, "data");
I'd be mush more better to allow null body and maybe even to generate validation messages similar to messages from JsonReader
I generated POST method from openapi and if I try to send a request with body "null" I get the following response:
I've already investigated and figured out that such strange answer is caused by NPE in
ru.tinkoff.kora.json.module.http.server.JsonReaderHttpServerRequestMapper<T>:22:Text "data" came from
HandleFuseableConditionalSubscriber#next:I'd be mush more better to allow
nullbody and maybe even to generate validation messages similar to messages fromJsonReader