Fix HTTP responses that caller asked to be JSON
If caller says he accepts application/json we need to be sure that we send an array. That wasn't quite working and hadn't been tested.
This commit is contained in:
@@ -65,7 +65,7 @@ public class FluxHttpMessageConverter implements HttpMessageConverter<Flux<Objec
|
||||
|
||||
MediaType mediaType = inputMessage.getHeaders().getContentType();
|
||||
if (mediaType != null) {
|
||||
if (mediaType.includes(MediaType.APPLICATION_JSON)) {
|
||||
if (!MediaType.ALL.equals(mediaType) && mediaType.includes(MediaType.APPLICATION_JSON)) {
|
||||
return new JsonObjectDecoder().decode(inputMessage.getBody());
|
||||
}
|
||||
if (mediaType.includes(EVENT_STREAM)) {
|
||||
|
||||
@@ -81,7 +81,7 @@ class ResponseBodyEmitterSubscriber<T> implements Subscriber<T>, Runnable {
|
||||
else {
|
||||
responseBodyEmitter.send(",");
|
||||
}
|
||||
if (value.getClass()==String.class) {
|
||||
if (value.getClass()==String.class && !((String)value).contains("\"")) {
|
||||
object = "\"" + value + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user