Skip to content

Commit 034c52c

Browse files
authored
Merge pull request #357 from chun37/fix/356/main
ResponseやRequestの構造体のフィールドが空なとき、resp.text()を1回だけ実行する
2 parents 2b14857 + 9a474fd commit 034c52c

File tree

4 files changed

+0
-6
lines changed

4 files changed

+0
-6
lines changed

pkg/client/typescript/templates/api.ts.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ class {{ $elem.Name }} {
233233
{{- if eq .HasResFields true }}
234234
const res = JSON.parse(responseText) as {{ $method.ResponseType }};
235235
{{- else }}
236-
await resp.text();
237236
const res = {} as {{ $method.ResponseType }};
238237
{{- end }}
239238
context.response = res;

pkg/client/typescript/testdata/api_client.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,6 @@ class ServiceUser2Client {
810810
await this.callMiddleware(this.afterMiddleware, context);
811811
throw new ApiError(resp, responseText);
812812
}
813-
await resp.text();
814813
const res = {} as ServiceUser2DeleteUserResponse;
815814
context.response = res;
816815
await this.callMiddleware(this.afterMiddleware, context);
@@ -1511,7 +1510,6 @@ class ServiceUserClient {
15111510
await this.callMiddleware(this.afterMiddleware, context);
15121511
throw new ApiError(resp, responseText);
15131512
}
1514-
await resp.text();
15151513
const res = {} as ServiceUserGetResponse;
15161514
context.response = res;
15171515
await this.callMiddleware(this.afterMiddleware, context);

samples/empty_root/clients/ts/api_client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ class FooBarClient {
175175
await this.callMiddleware(this.afterMiddleware, context);
176176
throw new ApiError(resp, responseText);
177177
}
178-
await resp.text();
179178
const res = {} as FooBarPostUserResponse;
180179
context.response = res;
181180
await this.callMiddleware(this.afterMiddleware, context);

samples/standard/clients/ts/api_client.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,6 @@ class ServiceUser2Client {
810810
await this.callMiddleware(this.afterMiddleware, context);
811811
throw new ApiError(resp, responseText);
812812
}
813-
await resp.text();
814813
const res = {} as ServiceUser2DeleteUserResponse;
815814
context.response = res;
816815
await this.callMiddleware(this.afterMiddleware, context);
@@ -1511,7 +1510,6 @@ class ServiceUserClient {
15111510
await this.callMiddleware(this.afterMiddleware, context);
15121511
throw new ApiError(resp, responseText);
15131512
}
1514-
await resp.text();
15151513
const res = {} as ServiceUserGetResponse;
15161514
context.response = res;
15171515
await this.callMiddleware(this.afterMiddleware, context);

0 commit comments

Comments
 (0)