Conversation
…tter JSON parsing doesn't mislabel the input as text.
| @@ -366,18 +367,26 @@ private static MimeType guessMimeType(Message message) { | |||
| } | |||
| try (InputStream inputStream = message.asInputStream()) { | |||
| try (JsonParser parser = Json.createParser(inputStream)) { | |||
There was a problem hiding this comment.
Gaat dit echt goed joh? Als ik dit zo lees, parse je een inputStream en als dat json is, of hij er geen json van kan maken, return dan APPLICATION_JSON - of wordt er dan geen NoSuchElementException gegooid? Ik vind het niet heel duidelijk zo
There was a problem hiding this comment.
Als het geen JSON is dan komt hij bij een ParseException en geeft hij TEXT terug.
Ik zal nog eens naar de code kijken of ik het duidelijker kan maken maar ik probeer te parsen zonder direct een hele JSON in memory te houden, vandaar dat ik de parse-events weggooi en niet een meer high-level parser gebruik.
There was a problem hiding this comment.
Hopefully the new version I pushed it clearer; I removed the NoSuchElementException because realistically it cannot happen anymore now that I check hasNext() in the while condition.
There was a problem hiding this comment.
Nice, this reads a lot better
|
(cherry picked from commit cd6ca5a)



Changes
Pull Request Checklist
Title
Issues
Backports
Documentation
Tests
Breaking changes