Skip to content

Commit ef2e765

Browse files
fix: Fix signature of beforeRequest method in Interceptor interface (box/box-codegen#625) (#446)
1 parent 874f259 commit ef2e765

File tree

3 files changed

+7
-38
lines changed

3 files changed

+7
-38
lines changed

.codegen.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "5604447", "specHash": "c9d7bb5", "version": "1.8.0" }
1+
{ "engineHash": "3799ab4", "specHash": "c9d7bb5", "version": "1.8.0" }

src/networking/interceptors.generated.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { FetchOptionsInput } from './fetchOptions.generated.js';
21
import { FetchOptions } from './fetchOptions.generated.js';
32
import { FetchResponse } from './fetchResponse.generated.js';
43
export interface Interceptor {
54
/**
6-
* @param {FetchOptionsInput} optionsInput
5+
* @param {FetchOptions} options
76
* @returns {FetchOptions}
87
*/
9-
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions;
8+
beforeRequest(options: FetchOptions): FetchOptions;
109
/**
1110
* @param {FetchResponse} response
1211
* @returns {FetchResponse}

src/test/client.generated.test.ts

+4-34
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,10 @@ export class InterceptorAddingRoleToFields implements Interceptor {
6868
>,
6969
) {}
7070
/**
71-
* @param {FetchOptionsInput} optionsInput
71+
* @param {FetchOptions} options
7272
* @returns {FetchOptions}
7373
*/
74-
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions {
75-
const options: FetchOptions = new FetchOptions({
76-
url: optionsInput.url,
77-
method: optionsInput.method,
78-
params: optionsInput.params,
79-
headers: optionsInput.headers,
80-
data: optionsInput.data,
81-
fileStream: optionsInput.fileStream,
82-
multipartData: optionsInput.multipartData,
83-
contentType: optionsInput.contentType,
84-
responseFormat: optionsInput.responseFormat,
85-
auth: optionsInput.auth,
86-
networkSession: optionsInput.networkSession,
87-
cancellationToken: optionsInput.cancellationToken,
88-
followRedirects: optionsInput.followRedirects,
89-
});
74+
beforeRequest(options: FetchOptions): FetchOptions {
9075
return new FetchOptions({
9176
url: options.url,
9277
method: options.method,
@@ -115,25 +100,10 @@ export class InterceptorThrowingError implements Interceptor {
115100
fields: Omit<InterceptorThrowingError, 'beforeRequest' | 'afterRequest'>,
116101
) {}
117102
/**
118-
* @param {FetchOptionsInput} optionsInput
103+
* @param {FetchOptions} options
119104
* @returns {FetchOptions}
120105
*/
121-
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions {
122-
const options: FetchOptions = new FetchOptions({
123-
url: optionsInput.url,
124-
method: optionsInput.method,
125-
params: optionsInput.params,
126-
headers: optionsInput.headers,
127-
data: optionsInput.data,
128-
fileStream: optionsInput.fileStream,
129-
multipartData: optionsInput.multipartData,
130-
contentType: optionsInput.contentType,
131-
responseFormat: optionsInput.responseFormat,
132-
auth: optionsInput.auth,
133-
networkSession: optionsInput.networkSession,
134-
cancellationToken: optionsInput.cancellationToken,
135-
followRedirects: optionsInput.followRedirects,
136-
});
106+
beforeRequest(options: FetchOptions): FetchOptions {
137107
return options;
138108
}
139109
/**

0 commit comments

Comments
 (0)