Skip to content

Commit 017de0e

Browse files
committed
- Fixed whitespace
1 parent 8e05e64 commit 017de0e

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/templates/core/angular/request.hbs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -67,43 +67,43 @@ import type { OpenAPIConfig } from './OpenAPI';
6767
* @throws ApiError
6868
*/
6969
export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: ApiRequestOptions): Observable<T> => {
70-
const url = getUrl(config, options);
71-
const formData = getFormData(options);
72-
const body = getRequestBody(options);
73-
74-
return getHeaders(config, options).pipe(
75-
mergeMap( headers => {
76-
return sendRequest<T>(config, options, http, url, formData, body, headers);
77-
}),
78-
map(response => {
79-
const responseBody = getResponseBody(response);
80-
const responseHeader = getResponseHeader(response, options.responseHeader);
81-
return {
82-
url,
83-
ok: response.ok,
84-
status: response.status,
85-
statusText: response.statusText,
86-
body: responseHeader ?? responseBody,
87-
} as ApiResult;
88-
}),
89-
catchError((error: HttpErrorResponse) => {
90-
if (!error.status) {
91-
return throwError(() => error);
92-
}
93-
return of({
94-
url,
95-
ok: error.ok,
96-
status: error.status,
97-
statusText: error.statusText,
98-
body: error.statusText,
99-
} as ApiResult);
100-
}),
101-
map(result => {
102-
catchErrorCodes(options, result);
103-
return result.body as T;
104-
}),
105-
catchError((error: ApiError) => {
106-
return throwError(() => error);
107-
}),
108-
);
70+
const url = getUrl(config, options);
71+
const formData = getFormData(options);
72+
const body = getRequestBody(options);
73+
74+
return getHeaders(config, options).pipe(
75+
mergeMap(headers => {
76+
return sendRequest<T>(config, options, http, url, formData, body, headers);
77+
}),
78+
map(response => {
79+
const responseBody = getResponseBody(response);
80+
const responseHeader = getResponseHeader(response, options.responseHeader);
81+
return {
82+
url,
83+
ok: response.ok,
84+
status: response.status,
85+
statusText: response.statusText,
86+
body: responseHeader ?? responseBody,
87+
} as ApiResult;
88+
}),
89+
catchError((error: HttpErrorResponse) => {
90+
if (!error.status) {
91+
return throwError(() => error);
92+
}
93+
return of({
94+
url,
95+
ok: error.ok,
96+
status: error.status,
97+
statusText: error.statusText,
98+
body: error.statusText,
99+
} as ApiResult);
100+
}),
101+
map(result => {
102+
catchErrorCodes(options, result);
103+
return result.body as T;
104+
}),
105+
catchError((error: ApiError) => {
106+
return throwError(() => error);
107+
}),
108+
);
109109
};

0 commit comments

Comments
 (0)