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

httpgrpc Server can now use message from HTTP header when converting HTTP response to error #531

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

pstibrany
Copy link
Member

What this PR does:

httpgrpc Server (implementation of httpgrpc.HTTP gRPC service) converts HTTP responses to errors under certain conditions. In this conversion it uses HTTP response body as an error message. If HTTP response body is not a valid UTF-8 string, then such converted error will not be protobuf-marshalable anymore.

This PR adds option to supply alternative error message for such conversion by setting special HTTP header, that is recognized by httpgrpc Server.

Which issue(s) this PR fixes:

Fixes #

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@pstibrany pstibrany requested a review from aknuds1 June 13, 2024 11:27
Copy link
Collaborator

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

LGTM, modulo nits plus what I think is a left behind copy-paste.

httpgrpc/server/server_test.go Outdated Show resolved Hide resolved
httpgrpc/server/server_test.go Outdated Show resolved Hide resolved
httpgrpc/server/server_test.go Outdated Show resolved Hide resolved
httpgrpc/server/server_test.go Outdated Show resolved Hide resolved
@pstibrany
Copy link
Member Author

LGTM, modulo nits plus what I think is a left behind copy-paste.

Thanks for review, I've addressed your feedback in 4330714

@pstibrany pstibrany merged commit 7e83c3c into main Jun 13, 2024
6 checks passed
@pstibrany pstibrany deleted the use-error-message-from-header branch June 13, 2024 13:19
pstibrany added a commit that referenced this pull request Jun 13, 2024
…HTTP response to error (#531)

* httpgrpc Server can now use error message from the header when converting HTTP response to error.

* CHANGELOG.md

* Make linter happy.

* Address review feedback.
pstibrany added a commit that referenced this pull request Jun 13, 2024
* httpgrpc Server can now use message from HTTP header when converting HTTP response to error (#531)
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