Skip to content

Commit

Permalink
fix: Fix signature of beforeRequest method in Interceptor interfa…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Dec 9, 2024
1 parent 874f259 commit ef2e765
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "5604447", "specHash": "c9d7bb5", "version": "1.8.0" }
{ "engineHash": "3799ab4", "specHash": "c9d7bb5", "version": "1.8.0" }
5 changes: 2 additions & 3 deletions src/networking/interceptors.generated.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { FetchOptionsInput } from './fetchOptions.generated.js';
import { FetchOptions } from './fetchOptions.generated.js';
import { FetchResponse } from './fetchResponse.generated.js';
export interface Interceptor {
/**
* @param {FetchOptionsInput} optionsInput
* @param {FetchOptions} options
* @returns {FetchOptions}
*/
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions;
beforeRequest(options: FetchOptions): FetchOptions;
/**
* @param {FetchResponse} response
* @returns {FetchResponse}
Expand Down
38 changes: 4 additions & 34 deletions src/test/client.generated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,10 @@ export class InterceptorAddingRoleToFields implements Interceptor {
>,
) {}
/**
* @param {FetchOptionsInput} optionsInput
* @param {FetchOptions} options
* @returns {FetchOptions}
*/
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions {
const options: FetchOptions = new FetchOptions({
url: optionsInput.url,
method: optionsInput.method,
params: optionsInput.params,
headers: optionsInput.headers,
data: optionsInput.data,
fileStream: optionsInput.fileStream,
multipartData: optionsInput.multipartData,
contentType: optionsInput.contentType,
responseFormat: optionsInput.responseFormat,
auth: optionsInput.auth,
networkSession: optionsInput.networkSession,
cancellationToken: optionsInput.cancellationToken,
followRedirects: optionsInput.followRedirects,
});
beforeRequest(options: FetchOptions): FetchOptions {
return new FetchOptions({
url: options.url,
method: options.method,
Expand Down Expand Up @@ -115,25 +100,10 @@ export class InterceptorThrowingError implements Interceptor {
fields: Omit<InterceptorThrowingError, 'beforeRequest' | 'afterRequest'>,
) {}
/**
* @param {FetchOptionsInput} optionsInput
* @param {FetchOptions} options
* @returns {FetchOptions}
*/
beforeRequest(optionsInput: FetchOptionsInput): FetchOptions {
const options: FetchOptions = new FetchOptions({
url: optionsInput.url,
method: optionsInput.method,
params: optionsInput.params,
headers: optionsInput.headers,
data: optionsInput.data,
fileStream: optionsInput.fileStream,
multipartData: optionsInput.multipartData,
contentType: optionsInput.contentType,
responseFormat: optionsInput.responseFormat,
auth: optionsInput.auth,
networkSession: optionsInput.networkSession,
cancellationToken: optionsInput.cancellationToken,
followRedirects: optionsInput.followRedirects,
});
beforeRequest(options: FetchOptions): FetchOptions {
return options;
}
/**
Expand Down

0 comments on commit ef2e765

Please sign in to comment.