-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
38 additions
and
77 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
/** | ||
* Decides how the body should be parsed based on its mime type. | ||
* Decides how the body should be parsed based on its mime type. Should match what's in parse_body | ||
* | ||
* This is intended to be used with both requests and responses, to have a consistent body parsing across adapters. | ||
* | ||
* @param {string} content_type The `content-type` header of a request/response. | ||
* @returns {boolean} | ||
*/ | ||
export function isContentTypeBinary(content_type) { | ||
export function isContentTypeTextual(content_type) { | ||
return ( | ||
content_type.startsWith('image/') || | ||
content_type.startsWith('audio/') || | ||
content_type.startsWith('video/') || | ||
content_type.startsWith('application/octet-stream') | ||
!content_type || // defaults to json | ||
content_type === 'text/plain' || | ||
content_type === 'application/json' || | ||
content_type === 'application/x-www-form-urlencoded' || | ||
content_type === 'multipart/form-data' | ||
); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.