gatsby
gatsby copied to clipboard
fix(gatsby): Proxy non-200 HTTP responses
Transfer errors responses from the proxied server, including the status code, to the client.
Credit for the solution to dangkyokhoang, who provided it here.
Description
Documentation
Related Issues
Fixes #36589, aka #34244, aka #33333.
Hi, thanks for the PR!
Linting is complaining about two things:
564:21 error Replace `response·=·err.response` with `(response·=·err.response)` prettier/prettier
564:21 error Expected a conditional expression and instead saw an assignment no-cond-assign
And I agree that this line here is incorrect:
if (response = err.response) {
You shouldn't do an assignment inside this expression. I think you just need to change the other line to
res.end(error.response.rawBody)
Please try that out
Sorry I can't find time to work on this.