Skip to content

Commit

Permalink
fix: use lowercase content-type header value (#279)
Browse files Browse the repository at this point in the history
Deployed to a server where .ts was being returned as video/MP2T instead of video/mp2t as required here. This particular header value is not case sensitive.

The type, subtype, and parameter names are not case sensitive. For example, TEXT, Text, and TeXt are all equivalent. Parameter values are normally case sensitive, but certain parameters are interpreted to be case- insensitive, depending on the intended use. (For example, multipart boundaries are case-sensitive, but the "access- type" for message/External-body is not case-sensitive.)

https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
  • Loading branch information
jpoehnelt authored Mar 4, 2022
1 parent b626e0d commit efc6658
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- ### Fixed -->
<!-- ### Removed -->

<!-- ## Unreleased -->
## Unreleased

### Fixed

- Normalize content-type response header to lowercase when matching filetypes.

## [0.15.0-pre.5] - 2022-02-23

Expand Down
3 changes: 2 additions & 1 deletion src/playground-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ const expandProjectConfig = async (
...info,
name: filename,
content: await resp.text(),
contentType: resp.headers.get('Content-Type') ?? 'text/plain',
contentType:
resp.headers.get('Content-Type')?.toLowerCase() ?? 'text/plain',
};
})()
);
Expand Down

0 comments on commit efc6658

Please sign in to comment.