Skip to content

Commit 9fa18d0

Browse files
RezraziCopilotCopilot
authored
feat(typescript): Update isomorphic-fetch file to allow for response streaming (#22673)
* Update isomorphic-fetch file to allow for response streaming (#1) * Update samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update samples/client/echo_api/typescript/build/http/http.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update samples * fix tests --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6022e4e commit 9fa18d0

25 files changed

Lines changed: 69 additions & 7 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/client/others/typescript/builds/array-of-lists/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/client/others/typescript/builds/enum-single-value/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/client/others/typescript/builds/null-types-simple/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/client/others/typescript/builds/with-unique-items/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/client/others/typescript/encode-decode/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/others/typescript/encode-decode/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.

0 commit comments

Comments
 (0)