Skip to content

Commit ebb8e9b

Browse files
fix: Buffer is allow as body without encoding to string (#223)
Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
1 parent 130953e commit ebb8e9b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/packages/teeny-request/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ function requestToFetchOptions(reqOpts: Options) {
105105
// Set body to JSON representation of value
106106
options.body = JSON.stringify(reqOpts.json);
107107
} else {
108-
if (typeof reqOpts.body !== 'string') {
108+
if (Buffer.isBuffer(reqOpts.body)) {
109+
options.body = reqOpts.body;
110+
} else if (typeof reqOpts.body !== 'string') {
109111
options.body = JSON.stringify(reqOpts.body);
110112
} else {
111113
options.body = reqOpts.body;

0 commit comments

Comments
 (0)