-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(server$): return content type changes #6345
Conversation
✅ Deploy Preview for qwik-insights ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying qwik-docs with
|
Latest commit: |
81332cd
|
Status: | ✅ Deploy successful! |
Preview URL: | https://8a857b08.qwik-8nx.pages.dev |
Branch Preview URL: | https://fix-server--json-response-la.qwik-8nx.pages.dev |
@@ -380,6 +380,18 @@ export const serverQrl = <T extends ServerFunction>( | |||
throw obj; | |||
} | |||
return obj; | |||
} else if (contentType === 'application/json') { |
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.
theses cases should never be hit but in cases that I mentioned it's better that they're handled
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.
Looks good to me! More descriptive errors -> happiness :)
You are doing a great job @PatrickJS 🚀 |
@@ -380,6 +380,18 @@ export const serverQrl = <T extends ServerFunction>( | |||
throw obj; | |||
} | |||
return obj; | |||
} else if (contentType === 'application/json') { | |||
const obj = await res.json(); | |||
if (res.status === 500) { |
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.
Should be >=400, no?
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.
it should never hit this case but for example of the Lambda blows up then aws will change the return headers/value
when server$ lambda blows up the content type changes.
this is needed for debugging