-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat!: pass-through response status and headers to client #44
feat!: pass-through response status and headers to client #44
Conversation
Breaking Change Resolves johannschopplich#25 and johannschopplich#41
β Deploy Preview for nuxt-api-party ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I love this approach. It should suit most use-cases and is worth a breaking change. Well done. π |
Have you tested |
I don't see why it would behave differently. If anything, putting it behind cloudflare would either suppress or expose the issue if it re-compresses the response. Honestly, the only reason I noticed this was because jsonplaceholder comments had the header |
Breaking Change
π Linked issue
Resolves #25 and #41
β Type of change
π Description
This change forwards the status code and headers from the API to the client. It also ensures any api errors are forwarded to the client as is.
Since ofetch always reads the body no matter what, it has to be read in as an
ArrayBuffer
then converted to anUint8Array
.An additional side-effect of this is the decoded body is forwarded instead of raw, which means if a
content-encoding
response header is set, it will be wrong. Removing this header corrects that.π Checklist