-
Notifications
You must be signed in to change notification settings - Fork 44
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: Add content-type media type parsing #678
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #678 +/- ##
===========================================
+ Coverage 57.21% 57.24% +0.02%
===========================================
Files 143 143
Lines 16383 16393 +10
===========================================
+ Hits 9374 9384 +10
Misses 6127 6127
Partials 882 882
|
switch req.Header.Get("Content-Type") { | ||
// extract the media type from the content-type header | ||
contentType, _, err := mime.ParseMediaType(req.Header.Get("Content-Type")) | ||
if err != nil && err.Error() != "mime: no media type" { |
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.
suggestion: add a comment explaining the err.Error() != "mime: no media type"
section if possible
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.
Let me know what you think of the comment.
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.
Thanks, very clear
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.
LGTM
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.
LGTM
279740e
to
480125e
Compare
Relevant issue(s) Resolves sourcenetwork#677 Description This PR fixes an issue where some http clients add parameters to the content-type and caused the content-type switch to fail.
Relevant issue(s)
Resolves #677
Description
This PR fixes an issue where some http clients add parameters to the content-type and caused the content-type switch to fail.
Tasks
How has this been tested?
unit test
Specify the platform(s) on which this was tested: