Skip to content

Commit

Permalink
update: add statusCode feature in testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
huequica committed Jan 16, 2023
1 parent e93bb9a commit e234a88
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/client/typescript/testdata/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface MiddlewareContext {
response?: unknown;
responseBody?: string;
responseHeaders?: Headers;
statusCode?: number;
baseURL: string;
headers: {[key: string]: string};
options: {[key: string]: any};
Expand Down Expand Up @@ -253,6 +254,7 @@ class ServiceClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -405,6 +407,7 @@ class ServiceGroupsClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -600,6 +603,7 @@ class ServiceStaticPageClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -805,6 +809,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -889,6 +894,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -989,6 +995,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1075,6 +1082,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1224,6 +1232,7 @@ class ServiceUser2UserIDClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1364,6 +1373,7 @@ class ServiceUser2UserIDJobIDClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1505,6 +1515,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1591,6 +1602,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1677,6 +1689,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1876,6 +1889,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1982,6 +1996,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -2074,6 +2089,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down

0 comments on commit e234a88

Please sign in to comment.