Skip to content

Commit d04d1cd

Browse files
authored
Merge pull request #1 from t0ggah/feature/stream-request-body
Use Stream in request body
2 parents 7717e98 + 74ee491 commit d04d1cd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/templates/core/node/getRequestBody.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function getRequestBody(options: ApiRequestOptions): BodyInit | undefined {
33
return getFormData(options.formData) as BodyInit;
44
}
55
if (options.body) {
6-
if (isString(options.body) || isBinary(options.body)) {
6+
if (isString(options.body) || isBinary(options.body) || options.body instanceof Stream)) {
77
return options.body as BodyInit;
88
} else {
99
return JSON.stringify(options.body);

src/templates/core/node/request.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import FormData from 'form-data';
44
import fetch, { BodyInit, Headers, RequestInit, Response } from 'node-fetch';
5+
import { Stream } from 'stream';
56
import { types } from 'util';
67

78
import { ApiError } from './ApiError';

0 commit comments

Comments
 (0)