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

Response headers, status code, and error handling #316

Merged
merged 5 commits into from
Dec 17, 2023

Conversation

oddwhocanfly
Copy link
Contributor

Proposed handler fixes and error handling improvements for #315

The general idea is to render component into a buffer before writing it to response, so that in the event of error, error handler can write its own response with correct status code and headers. The buffer is obtained with GetBuffer() and component should be able to use it directly as if it obtained buffer on its own.

Additionally, handler now sets headers to header map before writing response code, and does not write response code when calling error handler so that it can set its own headers and response code.

@oddwhocanfly oddwhocanfly changed the title Response headers, status code, and error handling #315 Response headers, status code, and error handling Dec 9, 2023
Copy link
Owner

@a-h a-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a minor refactor, as per @matryer's talk https://youtu.be/yeetIgNeIkc?si=7BiJMIsYe3Uvghjn&t=255

@a-h
Copy link
Owner

a-h commented Dec 17, 2023

Thanks for that, much appreciated! I'm prepping for a release, just want to do some work on #249, a bit more testing, and I'll push it.

@a-h a-h merged commit 99fd97f into a-h:main Dec 17, 2023
4 checks passed
@oddwhocanfly
Copy link
Contributor Author

Thank you! Yes, i did have a feeling that wasn't an idiomatic thing in go 🙂

@oddwhocanfly oddwhocanfly deleted the content_type_fix branch December 17, 2023 21:16
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.

2 participants