generated from honeycombio/.github
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Handle invalid content type errors first (#243)
## Which problem is this PR solving? Updates the error handling logic to check if the error is from an invalid content type first. This is necessary to ensure we can successfully create a valid OTLP response. This needs to be first because it determines how we present any errors back (eg invalid API ket). This PR also updates WriteOtlpHttpFailureResponse to check if the error is an invalid content type, and write a text/pain response if true. This removes the need for consumers of this function to have to do it themselves. ## Short description of the changes - Update each signal's validate headers function to check content type first - Update `WriteOtlpHttpResponse` to check if the content type is valid, if not writes a HTTP status code 415 text/plain error response instead - Update tests --------- Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
- Loading branch information
1 parent
52ecefd
commit dbe549c
Showing
2 changed files
with
58 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters