Add additional response representations - #96
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb25a555c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public List<ACCEPT_TYPE> getSupportedTypesInPreferenceOrder() { | ||
| List<ACCEPT_TYPE> supportedTypes = new ArrayList<>(); | ||
| for (String acceptedType : acceptMediaTypeDefinitionsList) { | ||
| ACCEPT_TYPE matchingType = getMatchingType(acceptedType); | ||
| if (matchingType != ACCEPT_TYPE.NO_MATCHING_TYPE) { | ||
| supportedTypes.add(matchingType); | ||
| } |
There was a problem hiding this comment.
Exclude zero-quality media types from response selection
When a client sends Accept: text/csv;q=0, application/json;q=1, the parser strips the parameters and still returns CSV first in this list, so HttpApiResponse responds with text/csv even though the client explicitly rejected it. Parse quality values, discard entries with q=0, and order the remaining representations by quality before selection.
Useful? React with 👍 / 👎.
| public String getJsonLines() { | ||
| return String.join("\n", jsonObjects()); |
There was a problem hiding this comment.
Terminate every NDJSON record with a newline
For any nonempty application/x-ndjson response, joining records places newlines only between them, leaving the final JSON text unterminated. NDJSON framing requires every JSON text to be followed by a newline, and the missing terminator can prevent incremental consumers from recognizing the last record or cause it to merge with subsequently concatenated output.
Useful? React with 👍 / 👎.
Summary
Verification
mvn -pl thingifier -am -DfailIfNoTests=false testmvn -q -DfailIfNoTests=false clean test-> 971 tests, 0 failures, 0 errors, 0 skippedCloses #91