Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Parse the MIME media type from the Content-Type header #9

Merged
merged 1 commit into from
Jul 20, 2016

Conversation

JayH5
Copy link

@JayH5 JayH5 commented Jul 20, 2016

  • Rather than just checking the raw header value
  • Don't parse the header if we're streaming everything anyway

* Rather than just checking the raw header value
* Don't parse the header if we're streaming everything anyway
@JayH5
Copy link
Author

JayH5 commented Jul 20, 2016

It's quite common for SSE sources to also specify the character set in the Content-Type header (even though the SSE spec only allows one character set). i.e. Content-Type: text/event-stream; charset=utf-8.

It's also technically correct to pass a Content-Type header value with leading or trailing whitespace or with mixed character case.

This PR uses mime.ParseMediaType to parse the MIME type from the Content-Type header correctly.

@emilevauge
Copy link
Member

Ouch, how did I miss that 😢 ...
Thanks for catching this @JayH5 !
LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants