Skip to content
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(client-sdks): handle 204 empty responses with runtime validation #288

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

mnahkies
Copy link
Owner

@mnahkies mnahkies commented Dec 21, 2024

Adds e2e tests for endpoints returning 204 / empty responses and relaxes runtime schema validation for clients to use any, allowing for axios returning an ""

Keeps the type as void which is somewhat a lie, but I believe a pragmatic decision - in practice you shouldn't be looking at the response body for a 204 at all, so it shouldn't really matter. The fetch client will continue to throw a JSON parse error if you attempt to read the empty response, which I think is fine for the same reason.

An alternative might've been to use a .transform(it => undefined) to coerce the runtime value to undefined but I don't think there is all that much value in this.

closes #285

@mnahkies mnahkies marked this pull request as ready for review December 22, 2024 09:50
@mnahkies mnahkies merged commit d3be20e into main Dec 22, 2024
4 checks passed
@mnahkies mnahkies deleted the mn/285/client-sdk-handles-204 branch December 22, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: (client sdks) 204 responses fail validation with --enable-runtime-response-validation
1 participant