-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improved serializer selection #620
Conversation
* chore(deps): bump @stoplight/http-spec from 2.1.4 to 2.2.1 Bumps [@stoplight/http-spec](https://github.com/stoplightio/http-spec) from 2.1.4 to 2.2.1. - [Release notes](https://github.com/stoplightio/http-spec/releases) - [Commits](stoplightio/http-spec@v2.1.4...v2.2.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * deps: upgrade again * refactor: write test text and done type
hi @StefanDywersant, please take a look at #604 (review) |
@StefanDywersant, I'll take a look when the conflict is resolved 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments but it looks good.
-
The fixtures should not be modified to return the charset because the OAS document does not specify it. If you apply my suggestions, it works correctly; I guess the default serialiser is still being kicked off for some reason.
-
It would be better to write this test as an E2E test; you can find more informations in the README of the test-harness directory.
test-harness/specs/E2E-Accept-Content-Negotiation-AC-1.oas2.txt
Outdated
Show resolved
Hide resolved
@XVincentX, I understand your reasoning in #620 (comment) Personally, I would only use the imperative style if something is not possible to do in FP. We don't really need the mayhem of mutations and exceptions being thrown throughout the code. I like your distinction here, it's like Elm/Haskell purity of the code vs side effects taken care of by the compilers, but would try to make that imperative world as small as possible still. |
Closes #589
Checklist
What kind of change does this PR introduce?
Bugfix
What is the current behavior? What is the new behavior?
Current behavior:
Accept
header negotiation is done in two places: in negotiator and in http-server.To reproduce:
Results in:
Negotiator selects application/json as it matches available contents.
http-server serializes content as xml because Accept header has xml and xml serializer exists.
New behavior:
http-server serialzes the content according to what negotiator negotiated.
Does this PR introduce a breaking change?
No