Skip to content

Commit 233cb88

Browse files
committed
fix: responseType: blob
1 parent 850f467 commit 233cb88

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

integration-tests/typescript-angular/src/generated/api.github.com.yaml/client.service.ts

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

integration-tests/typescript-angular/src/generated/okta.oauth.yaml/client.service.ts

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

integration-tests/typescript-angular/src/generated/stripe.yaml/client.service.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.

packages/openapi-code-generator/src/typescript/client/typescript-angular/angular-service-builder.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export class AngularServiceBuilder extends AbstractClientBuilder {
4646
.concat(["HttpResponse<unknown>"])
4747
.join(" | ")
4848

49+
const isBlobResponse = builder
50+
.returnType()
51+
.filter((it) => it.statusType.startsWith("2"))
52+
.every((it) => it.responseType === "Blob")
53+
4954
const url = builder.routeToTemplateString()
5055

5156
const body = `
@@ -73,6 +78,7 @@ return this.httpClient.request<any>(
7378
: `// todo: request bodies with content-type '${requestBody.contentType}' not yet supported`
7479
: "",
7580
'observe: "response"',
81+
isBlobResponse ? "responseType: blob" : "",
7682
"reportProgress: false",
7783
]
7884
.filter(Boolean)

0 commit comments

Comments
 (0)