@goast/typescript 0.3.7 → 0.3.8-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,374 +1,374 @@
1
- import { HttpRequest, HttpParams, HttpHeaders, HttpContext } from '@angular/common/http';
2
-
3
- import type { HttpParameterCodec } from '@angular/common/http';
4
-
5
- /**
6
- * Custom parameter codec to correctly handle the plus sign in parameter
7
- * values. See https://github.com/angular/angular/issues/18261
8
- */
9
- class ParameterCodec implements HttpParameterCodec {
10
- encodeKey(key: string): string {
11
- return encodeURIComponent(key);
12
- }
13
-
14
- encodeValue(value: string): string {
15
- return encodeURIComponent(value);
16
- }
17
-
18
- decodeKey(key: string): string {
19
- return decodeURIComponent(key);
20
- }
21
-
22
- decodeValue(value: string): string {
23
- return decodeURIComponent(value);
24
- }
25
- }
26
- const ParameterCodecInstance = new ParameterCodec();
27
-
28
- /**
29
- * Defines the options for appending a parameter
30
- */
31
- interface ParameterOptions {
32
- style?: string;
33
- explode?: boolean;
34
- }
35
-
36
- /**
37
- * Base class for a parameter
38
- */
39
- abstract class Parameter {
40
- constructor(
41
- public name: string,
42
- public value: any,
43
- public options: ParameterOptions,
44
- defaultStyle: string,
45
- defaultExplode: boolean,
46
- ) {
47
- this.options = options || {};
48
- if (this.options.style === null || this.options.style === undefined) {
49
- this.options.style = defaultStyle;
50
- }
51
- if (this.options.explode === null || this.options.explode === undefined) {
52
- this.options.explode = defaultExplode;
53
- }
54
- }
55
-
56
- serializeValue(value: any, separator = ','): string {
57
- if (value === null || value === undefined) {
58
- return '';
59
- } else if (value instanceof Array) {
60
- return value
61
- .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator)))
62
- .join(separator);
63
- } else if (typeof value === 'object') {
64
- const array: string[] = [];
65
- for (const key of Object.keys(value)) {
66
- let propVal = value[key];
67
- if (propVal !== null && propVal !== undefined) {
68
- propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator));
69
- if (this.options.explode) {
70
- array.push(`${key}=${propVal}`);
71
- } else {
72
- array.push(key);
73
- array.push(propVal);
74
- }
75
- }
76
- }
77
- return array.join(separator);
78
- } else {
79
- return String(value);
80
- }
81
- }
82
- }
83
-
84
- /**
85
- * A parameter in the operation path
86
- */
87
- class PathParameter extends Parameter {
88
- constructor(name: string, value: any, options: ParameterOptions) {
89
- super(name, value, options, 'simple', false);
90
- }
91
-
92
- append(path: string): string {
93
- let value = this.value;
94
- if (value === null || value === undefined) {
95
- value = '';
96
- }
97
- let prefix = this.options.style === 'label' ? '.' : '';
98
- const separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ',';
99
- let alreadySerialized = false;
100
- if (this.options.style === 'matrix') {
101
- // The parameter name is just used as prefix, except in some cases...
102
- prefix = `;${this.name}=`;
103
- if (this.options.explode && typeof value === 'object') {
104
- prefix = ';';
105
- if (value instanceof Array) {
106
- // For arrays we have to repeat the name for each element
107
- value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`);
108
- value = value.join(';');
109
- alreadySerialized = true;
110
- } else {
111
- // For objects we have to put each the key / value pairs
112
- value = this.serializeValue(value, ';');
113
- alreadySerialized = true;
114
- }
115
- }
116
- }
117
- value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator));
118
- // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account
119
- path = path.replace(`{${this.name}}`, value);
120
- path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value);
121
- return path;
122
- }
123
-
124
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
125
- // @ts-ignore
126
- serializeValue(value: any, separator = ','): string {
127
- let result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator);
128
- result = result.replace(/%3D/g, '=');
129
- result = result.replace(/%3B/g, ';');
130
- result = result.replace(/%2C/g, ',');
131
- return result;
132
- }
133
- }
134
-
135
- /**
136
- * A parameter in the query
137
- */
138
- class QueryParameter extends Parameter {
139
- constructor(name: string, value: any, options: ParameterOptions) {
140
- super(name, value, options, 'form', true);
141
- }
142
-
143
- append(params: HttpParams): HttpParams {
144
- if (this.value instanceof Array) {
145
- // Array serialization
146
- if (this.options.explode) {
147
- for (const v of this.value) {
148
- params = params.append(this.name, this.serializeValue(v));
149
- }
150
- } else {
151
- const separator =
152
- this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ',';
153
- return params.append(this.name, this.serializeValue(this.value, separator));
154
- }
155
- } else if (this.value !== null && typeof this.value === 'object') {
156
- // Object serialization
157
- if (this.options.style === 'deepObject') {
158
- // Append a parameter for each key, in the form `name[key]`
159
- for (const key of Object.keys(this.value)) {
160
- const propVal = this.value[key];
161
- if (propVal !== null && propVal !== undefined) {
162
- params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal));
163
- }
164
- }
165
- } else if (this.options.explode) {
166
- // Append a parameter for each key without using the parameter name
167
- for (const key of Object.keys(this.value)) {
168
- const propVal = this.value[key];
169
- if (propVal !== null && propVal !== undefined) {
170
- params = params.append(key, this.serializeValue(propVal));
171
- }
172
- }
173
- } else {
174
- // Append a single parameter whose values are a comma-separated list of key,value,key,value...
175
- const array: any[] = [];
176
- for (const key of Object.keys(this.value)) {
177
- const propVal = this.value[key];
178
- if (propVal !== null && propVal !== undefined) {
179
- array.push(key);
180
- array.push(propVal);
181
- }
182
- }
183
- params = params.append(this.name, this.serializeValue(array));
184
- }
185
- } else if (this.value !== null && this.value !== undefined) {
186
- // Plain value
187
- params = params.append(this.name, this.serializeValue(this.value));
188
- }
189
- return params;
190
- }
191
- }
192
-
193
- /**
194
- * A parameter in the HTTP request header
195
- */
196
- class HeaderParameter extends Parameter {
197
- constructor(name: string, value: any, options: ParameterOptions) {
198
- super(name, value, options, 'simple', false);
199
- }
200
-
201
- append(headers: HttpHeaders): HttpHeaders {
202
- if (this.value !== null && this.value !== undefined) {
203
- if (this.value instanceof Array) {
204
- for (const v of this.value) {
205
- headers = headers.append(this.name, this.serializeValue(v));
206
- }
207
- } else {
208
- headers = headers.append(this.name, this.serializeValue(this.value));
209
- }
210
- }
211
- return headers;
212
- }
213
- }
214
-
215
- /**
216
- * Helper to build http requests from parameters
217
- */
218
- export class RequestBuilder {
219
- private _path = new Map<string, PathParameter>();
220
- private _query = new Map<string, QueryParameter>();
221
- private _header = new Map<string, HeaderParameter>();
222
- _bodyContent: any | null;
223
- _bodyContentType?: string;
224
-
225
- constructor(
226
- public rootUrl: string,
227
- public operationPath: string,
228
- public method: string,
229
- ) {}
230
-
231
- /**
232
- * Sets a path parameter
233
- */
234
- path(name: string, value: any, options?: ParameterOptions): void {
235
- this._path.set(name, new PathParameter(name, value, options || {}));
236
- }
237
-
238
- /**
239
- * Sets a query parameter
240
- */
241
- query(name: string, value: any, options?: ParameterOptions): void {
242
- this._query.set(name, new QueryParameter(name, value, options || {}));
243
- }
244
-
245
- /**
246
- * Sets a header parameter
247
- */
248
- header(name: string, value: any, options?: ParameterOptions): void {
249
- this._header.set(name, new HeaderParameter(name, value, options || {}));
250
- }
251
-
252
- /**
253
- * Sets the body content, along with the content type
254
- */
255
- body(value: any, contentType = 'application/json'): void {
256
- if (value instanceof Blob) {
257
- this._bodyContentType = value.type;
258
- } else {
259
- this._bodyContentType = contentType;
260
- }
261
- if (this._bodyContentType === 'application/x-www-form-urlencoded' && value !== null && typeof value === 'object') {
262
- // Handle URL-encoded data
263
- const pairs: Array<[string, string]> = [];
264
- for (const key of Object.keys(value)) {
265
- let val = value[key];
266
- if (!(val instanceof Array)) {
267
- val = [val];
268
- }
269
- for (const v of val) {
270
- const formValue = this.formDataValue(v);
271
- if (formValue !== null) {
272
- pairs.push([key, formValue]);
273
- }
274
- }
275
- }
276
- this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&');
277
- } else if (this._bodyContentType === 'multipart/form-data') {
278
- // Handle multipart form data
279
- const formData = new FormData();
280
- if (value !== null && value !== undefined) {
281
- for (const key of Object.keys(value)) {
282
- const val = value[key];
283
- if (val instanceof Array) {
284
- for (const v of val) {
285
- const toAppend = this.formDataValue(v);
286
- if (toAppend !== null) {
287
- formData.append(key, toAppend);
288
- }
289
- }
290
- } else {
291
- const toAppend = this.formDataValue(val);
292
- if (toAppend !== null) {
293
- formData.set(key, toAppend);
294
- }
295
- }
296
- }
297
- }
298
- this._bodyContent = formData;
299
- } else {
300
- // The body is the plain content
301
- this._bodyContent = value;
302
- }
303
- }
304
-
305
- private formDataValue(value: any): any {
306
- if (value === null || value === undefined) {
307
- return null;
308
- }
309
- if (value instanceof Blob) {
310
- return value;
311
- }
312
- if (typeof value === 'object') {
313
- return JSON.stringify(value);
314
- }
315
- return String(value);
316
- }
317
-
318
- /**
319
- * Builds the request with the current set parameters
320
- */
321
- build<T = any>(options?: {
322
- /** Which content types to accept */
323
- accept?: string;
324
-
325
- /** The expected response type */
326
- responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
327
-
328
- /** Whether to report progress on uploads / downloads */
329
- reportProgress?: boolean;
330
-
331
- /** Allow passing HttpContext for HttpClient */
332
- context?: HttpContext;
333
- }): HttpRequest<T> {
334
- options = options || {};
335
-
336
- // Path parameters
337
- let path = this.operationPath;
338
- for (const pathParam of this._path.values()) {
339
- path = pathParam.append(path);
340
- }
341
- const url = this.rootUrl + path;
342
-
343
- // Query parameters
344
- let httpParams = new HttpParams({
345
- encoder: ParameterCodecInstance,
346
- });
347
- for (const queryParam of this._query.values()) {
348
- httpParams = queryParam.append(httpParams);
349
- }
350
-
351
- // Header parameters
352
- let httpHeaders = new HttpHeaders();
353
- if (options.accept) {
354
- httpHeaders = httpHeaders.append('Accept', options.accept);
355
- }
356
- for (const headerParam of this._header.values()) {
357
- httpHeaders = headerParam.append(httpHeaders);
358
- }
359
-
360
- // Request content headers
361
- if (this._bodyContentType && !(this._bodyContent instanceof FormData)) {
362
- httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType);
363
- }
364
-
365
- // Perform the request
366
- return new HttpRequest<T>(this.method.toUpperCase(), url, this._bodyContent, {
367
- params: httpParams,
368
- headers: httpHeaders,
369
- responseType: options.responseType,
370
- reportProgress: options.reportProgress,
371
- context: options.context,
372
- });
373
- }
374
- }
1
+ import { HttpRequest, HttpParams, HttpHeaders, HttpContext } from '@angular/common/http';
2
+
3
+ import type { HttpParameterCodec } from '@angular/common/http';
4
+
5
+ /**
6
+ * Custom parameter codec to correctly handle the plus sign in parameter
7
+ * values. See https://github.com/angular/angular/issues/18261
8
+ */
9
+ class ParameterCodec implements HttpParameterCodec {
10
+ encodeKey(key: string): string {
11
+ return encodeURIComponent(key);
12
+ }
13
+
14
+ encodeValue(value: string): string {
15
+ return encodeURIComponent(value);
16
+ }
17
+
18
+ decodeKey(key: string): string {
19
+ return decodeURIComponent(key);
20
+ }
21
+
22
+ decodeValue(value: string): string {
23
+ return decodeURIComponent(value);
24
+ }
25
+ }
26
+ const ParameterCodecInstance = new ParameterCodec();
27
+
28
+ /**
29
+ * Defines the options for appending a parameter
30
+ */
31
+ interface ParameterOptions {
32
+ style?: string;
33
+ explode?: boolean;
34
+ }
35
+
36
+ /**
37
+ * Base class for a parameter
38
+ */
39
+ abstract class Parameter {
40
+ constructor(
41
+ public name: string,
42
+ public value: any,
43
+ public options: ParameterOptions,
44
+ defaultStyle: string,
45
+ defaultExplode: boolean,
46
+ ) {
47
+ this.options = options || {};
48
+ if (this.options.style === null || this.options.style === undefined) {
49
+ this.options.style = defaultStyle;
50
+ }
51
+ if (this.options.explode === null || this.options.explode === undefined) {
52
+ this.options.explode = defaultExplode;
53
+ }
54
+ }
55
+
56
+ serializeValue(value: any, separator = ','): string {
57
+ if (value === null || value === undefined) {
58
+ return '';
59
+ } else if (value instanceof Array) {
60
+ return value
61
+ .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator)))
62
+ .join(separator);
63
+ } else if (typeof value === 'object') {
64
+ const array: string[] = [];
65
+ for (const key of Object.keys(value)) {
66
+ let propVal = value[key];
67
+ if (propVal !== null && propVal !== undefined) {
68
+ propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator));
69
+ if (this.options.explode) {
70
+ array.push(`${key}=${propVal}`);
71
+ } else {
72
+ array.push(key);
73
+ array.push(propVal);
74
+ }
75
+ }
76
+ }
77
+ return array.join(separator);
78
+ } else {
79
+ return String(value);
80
+ }
81
+ }
82
+ }
83
+
84
+ /**
85
+ * A parameter in the operation path
86
+ */
87
+ class PathParameter extends Parameter {
88
+ constructor(name: string, value: any, options: ParameterOptions) {
89
+ super(name, value, options, 'simple', false);
90
+ }
91
+
92
+ append(path: string): string {
93
+ let value = this.value;
94
+ if (value === null || value === undefined) {
95
+ value = '';
96
+ }
97
+ let prefix = this.options.style === 'label' ? '.' : '';
98
+ const separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ',';
99
+ let alreadySerialized = false;
100
+ if (this.options.style === 'matrix') {
101
+ // The parameter name is just used as prefix, except in some cases...
102
+ prefix = `;${this.name}=`;
103
+ if (this.options.explode && typeof value === 'object') {
104
+ prefix = ';';
105
+ if (value instanceof Array) {
106
+ // For arrays we have to repeat the name for each element
107
+ value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`);
108
+ value = value.join(';');
109
+ alreadySerialized = true;
110
+ } else {
111
+ // For objects we have to put each the key / value pairs
112
+ value = this.serializeValue(value, ';');
113
+ alreadySerialized = true;
114
+ }
115
+ }
116
+ }
117
+ value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator));
118
+ // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account
119
+ path = path.replace(`{${this.name}}`, value);
120
+ path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value);
121
+ return path;
122
+ }
123
+
124
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
125
+ // @ts-ignore
126
+ serializeValue(value: any, separator = ','): string {
127
+ let result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator);
128
+ result = result.replace(/%3D/g, '=');
129
+ result = result.replace(/%3B/g, ';');
130
+ result = result.replace(/%2C/g, ',');
131
+ return result;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * A parameter in the query
137
+ */
138
+ class QueryParameter extends Parameter {
139
+ constructor(name: string, value: any, options: ParameterOptions) {
140
+ super(name, value, options, 'form', true);
141
+ }
142
+
143
+ append(params: HttpParams): HttpParams {
144
+ if (this.value instanceof Array) {
145
+ // Array serialization
146
+ if (this.options.explode) {
147
+ for (const v of this.value) {
148
+ params = params.append(this.name, this.serializeValue(v));
149
+ }
150
+ } else {
151
+ const separator =
152
+ this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ',';
153
+ return params.append(this.name, this.serializeValue(this.value, separator));
154
+ }
155
+ } else if (this.value !== null && typeof this.value === 'object') {
156
+ // Object serialization
157
+ if (this.options.style === 'deepObject') {
158
+ // Append a parameter for each key, in the form `name[key]`
159
+ for (const key of Object.keys(this.value)) {
160
+ const propVal = this.value[key];
161
+ if (propVal !== null && propVal !== undefined) {
162
+ params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal));
163
+ }
164
+ }
165
+ } else if (this.options.explode) {
166
+ // Append a parameter for each key without using the parameter name
167
+ for (const key of Object.keys(this.value)) {
168
+ const propVal = this.value[key];
169
+ if (propVal !== null && propVal !== undefined) {
170
+ params = params.append(key, this.serializeValue(propVal));
171
+ }
172
+ }
173
+ } else {
174
+ // Append a single parameter whose values are a comma-separated list of key,value,key,value...
175
+ const array: any[] = [];
176
+ for (const key of Object.keys(this.value)) {
177
+ const propVal = this.value[key];
178
+ if (propVal !== null && propVal !== undefined) {
179
+ array.push(key);
180
+ array.push(propVal);
181
+ }
182
+ }
183
+ params = params.append(this.name, this.serializeValue(array));
184
+ }
185
+ } else if (this.value !== null && this.value !== undefined) {
186
+ // Plain value
187
+ params = params.append(this.name, this.serializeValue(this.value));
188
+ }
189
+ return params;
190
+ }
191
+ }
192
+
193
+ /**
194
+ * A parameter in the HTTP request header
195
+ */
196
+ class HeaderParameter extends Parameter {
197
+ constructor(name: string, value: any, options: ParameterOptions) {
198
+ super(name, value, options, 'simple', false);
199
+ }
200
+
201
+ append(headers: HttpHeaders): HttpHeaders {
202
+ if (this.value !== null && this.value !== undefined) {
203
+ if (this.value instanceof Array) {
204
+ for (const v of this.value) {
205
+ headers = headers.append(this.name, this.serializeValue(v));
206
+ }
207
+ } else {
208
+ headers = headers.append(this.name, this.serializeValue(this.value));
209
+ }
210
+ }
211
+ return headers;
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Helper to build http requests from parameters
217
+ */
218
+ export class RequestBuilder {
219
+ private _path = new Map<string, PathParameter>();
220
+ private _query = new Map<string, QueryParameter>();
221
+ private _header = new Map<string, HeaderParameter>();
222
+ _bodyContent: any | null;
223
+ _bodyContentType?: string;
224
+
225
+ constructor(
226
+ public rootUrl: string,
227
+ public operationPath: string,
228
+ public method: string,
229
+ ) {}
230
+
231
+ /**
232
+ * Sets a path parameter
233
+ */
234
+ path(name: string, value: any, options?: ParameterOptions): void {
235
+ this._path.set(name, new PathParameter(name, value, options || {}));
236
+ }
237
+
238
+ /**
239
+ * Sets a query parameter
240
+ */
241
+ query(name: string, value: any, options?: ParameterOptions): void {
242
+ this._query.set(name, new QueryParameter(name, value, options || {}));
243
+ }
244
+
245
+ /**
246
+ * Sets a header parameter
247
+ */
248
+ header(name: string, value: any, options?: ParameterOptions): void {
249
+ this._header.set(name, new HeaderParameter(name, value, options || {}));
250
+ }
251
+
252
+ /**
253
+ * Sets the body content, along with the content type
254
+ */
255
+ body(value: any, contentType = 'application/json'): void {
256
+ if (value instanceof Blob) {
257
+ this._bodyContentType = value.type;
258
+ } else {
259
+ this._bodyContentType = contentType;
260
+ }
261
+ if (this._bodyContentType === 'application/x-www-form-urlencoded' && value !== null && typeof value === 'object') {
262
+ // Handle URL-encoded data
263
+ const pairs: Array<[string, string]> = [];
264
+ for (const key of Object.keys(value)) {
265
+ let val = value[key];
266
+ if (!(val instanceof Array)) {
267
+ val = [val];
268
+ }
269
+ for (const v of val) {
270
+ const formValue = this.formDataValue(v);
271
+ if (formValue !== null) {
272
+ pairs.push([key, formValue]);
273
+ }
274
+ }
275
+ }
276
+ this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&');
277
+ } else if (this._bodyContentType === 'multipart/form-data') {
278
+ // Handle multipart form data
279
+ const formData = new FormData();
280
+ if (value !== null && value !== undefined) {
281
+ for (const key of Object.keys(value)) {
282
+ const val = value[key];
283
+ if (val instanceof Array) {
284
+ for (const v of val) {
285
+ const toAppend = this.formDataValue(v);
286
+ if (toAppend !== null) {
287
+ formData.append(key, toAppend);
288
+ }
289
+ }
290
+ } else {
291
+ const toAppend = this.formDataValue(val);
292
+ if (toAppend !== null) {
293
+ formData.set(key, toAppend);
294
+ }
295
+ }
296
+ }
297
+ }
298
+ this._bodyContent = formData;
299
+ } else {
300
+ // The body is the plain content
301
+ this._bodyContent = value;
302
+ }
303
+ }
304
+
305
+ private formDataValue(value: any): any {
306
+ if (value === null || value === undefined) {
307
+ return null;
308
+ }
309
+ if (value instanceof Blob) {
310
+ return value;
311
+ }
312
+ if (typeof value === 'object') {
313
+ return new Blob([JSON.stringify(value)], { type: 'application/json' });
314
+ }
315
+ return String(value);
316
+ }
317
+
318
+ /**
319
+ * Builds the request with the current set parameters
320
+ */
321
+ build<T = any>(options?: {
322
+ /** Which content types to accept */
323
+ accept?: string;
324
+
325
+ /** The expected response type */
326
+ responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
327
+
328
+ /** Whether to report progress on uploads / downloads */
329
+ reportProgress?: boolean;
330
+
331
+ /** Allow passing HttpContext for HttpClient */
332
+ context?: HttpContext;
333
+ }): HttpRequest<T> {
334
+ options = options || {};
335
+
336
+ // Path parameters
337
+ let path = this.operationPath;
338
+ for (const pathParam of this._path.values()) {
339
+ path = pathParam.append(path);
340
+ }
341
+ const url = this.rootUrl + path;
342
+
343
+ // Query parameters
344
+ let httpParams = new HttpParams({
345
+ encoder: ParameterCodecInstance,
346
+ });
347
+ for (const queryParam of this._query.values()) {
348
+ httpParams = queryParam.append(httpParams);
349
+ }
350
+
351
+ // Header parameters
352
+ let httpHeaders = new HttpHeaders();
353
+ if (options.accept) {
354
+ httpHeaders = httpHeaders.append('Accept', options.accept);
355
+ }
356
+ for (const headerParam of this._header.values()) {
357
+ httpHeaders = headerParam.append(httpHeaders);
358
+ }
359
+
360
+ // Request content headers
361
+ if (this._bodyContentType && !(this._bodyContent instanceof FormData)) {
362
+ httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType);
363
+ }
364
+
365
+ // Perform the request
366
+ return new HttpRequest<T>(this.method.toUpperCase(), url, this._bodyContent, {
367
+ params: httpParams,
368
+ headers: httpHeaders,
369
+ responseType: options.responseType,
370
+ reportProgress: options.reportProgress,
371
+ context: options.context,
372
+ });
373
+ }
374
+ }