Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: Buffer is allow as body without encoding to string (#223)
Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
  • Loading branch information
alexpts and JustinBeckwith committed May 19, 2021
1 parent 3e7424f commit d9bcdc3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Expand Up @@ -105,7 +105,9 @@ function requestToFetchOptions(reqOpts: Options) {
// Set body to JSON representation of value
options.body = JSON.stringify(reqOpts.json);
} else {
if (typeof reqOpts.body !== 'string') {
if (Buffer.isBuffer(reqOpts.body)) {
options.body = reqOpts.body;
} else if (typeof reqOpts.body !== 'string') {
options.body = JSON.stringify(reqOpts.body);
} else {
options.body = reqOpts.body;
Expand Down

0 comments on commit d9bcdc3

Please sign in to comment.