Skip to content

Commit 30f1f36

Browse files
authored
Update isomorphic-fetch file to allow for response streaming (#1)
1 parent f1322a0 commit 30f1f36

11 files changed

Lines changed: 44 additions & 5 deletions

File tree

modules/openapi-generator/src/main/resources/typescript/http/http.mustache

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ export class RequestContext {
216216
export interface ResponseBody {
217217
text(): Promise<string>;
218218
binary(): Promise<{{{fileContentDataType}}}>;
219+
{{#platforms}}
220+
{{#node}}
221+
stream(): ReadableStream<Uint8Array> | null;
222+
{{/node}}
223+
{{/platforms}}
219224
}
220225

221226
/**
@@ -253,6 +258,14 @@ export class SelfDecodingBody implements ResponseBody {
253258
{{/deno}}
254259
{{/platforms}}
255260
}
261+
262+
{{#platforms}}
263+
{{#node}}
264+
stream(): ReadableStream<Uint8Array> | null {
265+
return null;
266+
}
267+
{{/node}}
268+
{{/platforms}}
256269
}
257270

258271
export class ResponseContext {

modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
3838
{{#node}}
3939
const body = {
4040
text: () => resp.text(),
41-
binary: () => resp.buffer()
41+
binary: () => resp.buffer(),
42+
stream: () => resp.body
4243
};
4344
{{/node}}
4445
{{^node}}

samples/client/echo_api/typescript/build/http/http.ts

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/default/http/http.ts

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)