Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev committed Jan 9, 2025
1 parent 12ff8f0 commit 1d57fb2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/http/fetch/src/middlewares/middlewareFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { RedirectHandler } from "./redirectHandler";
import { RetryHandler } from "./retryHandler";
import { UserAgentHandler } from "./userAgentHandler";
import { CompressionHandler } from "./compressionHandler";
import {UrlReplaceHandler} from "./urlReplaceHandler";
import { UrlReplaceHandler } from "./urlReplaceHandler";

/**
*
Expand All @@ -27,6 +27,6 @@ export class MiddlewareFactory {
*/
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
public static getDefaultMiddlewares(customFetch: (request: string, init: RequestInit) => Promise<Response> = (...args) => fetch(...args) as any): Middleware[] {
return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new CompressionHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch), new UrlReplaceHandler()];
return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new CompressionHandler(), new HeadersInspectionHandler(), new UrlReplaceHandler(), new CustomFetchHandler(customFetch)];
}
}
15 changes: 3 additions & 12 deletions packages/http/fetch/test/browser/kiotaClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,7 @@

import { assert, describe, it } from "vitest";

import {
CustomFetchHandler,
HeadersInspectionHandler,
KiotaClientFactory,
ParametersNameDecodingHandler,
RedirectHandler,
RetryHandler,
UrlReplaceHandler,
UserAgentHandler
} from "../../src";
import { CustomFetchHandler, HeadersInspectionHandler, KiotaClientFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UrlReplaceHandler, UserAgentHandler } from "../../src";
import { CompressionHandler } from "../../src/middlewares/compressionHandler";

describe("browser - KiotaClientFactory", () => {
Expand All @@ -31,7 +22,7 @@ describe("browser - KiotaClientFactory", () => {
assert.isTrue(middleware?.next?.next?.next instanceof UserAgentHandler);
assert.isTrue(middleware?.next?.next?.next?.next instanceof CompressionHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next instanceof HeadersInspectionHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next instanceof CustomFetchHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next?.next instanceof UrlReplaceHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next instanceof UrlReplaceHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next?.next instanceof CustomFetchHandler);
});
});
1 change: 1 addition & 0 deletions packages/http/fetch/test/browser/middlewareFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ describe("browser - MiddlewareFactory", () => {
assert.isTrue(defaultMiddleWareArray[4] instanceof CompressionHandler);
assert.isTrue(defaultMiddleWareArray[5] instanceof HeadersInspectionHandler);
assert.isTrue(defaultMiddleWareArray[6] instanceof CustomFetchHandler);
assert.isTrue(defaultMiddleWareArray[7] instanceof CustomFetchHandler);
});
});
15 changes: 3 additions & 12 deletions packages/http/fetch/test/node/kiotaClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
*/

import { assert, describe, it } from "vitest";
import {
CustomFetchHandler,
HeadersInspectionHandler,
KiotaClientFactory,
ParametersNameDecodingHandler,
RedirectHandler,
RetryHandler,
UrlReplaceHandler,
UserAgentHandler
} from "../../src";
import { CustomFetchHandler, HeadersInspectionHandler, KiotaClientFactory, ParametersNameDecodingHandler, RedirectHandler, RetryHandler, UrlReplaceHandler, UserAgentHandler } from "../../src";
import { CompressionHandler } from "../../src/middlewares/compressionHandler";

describe("browser - KiotaClientFactory", () => {
Expand All @@ -30,8 +21,8 @@ describe("browser - KiotaClientFactory", () => {
assert.isTrue(middleware?.next?.next?.next instanceof UserAgentHandler);
assert.isTrue(middleware?.next?.next?.next?.next instanceof CompressionHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next instanceof HeadersInspectionHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next instanceof CustomFetchHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next?.next instanceof UrlReplaceHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next instanceof UrlReplaceHandler);
assert.isTrue(middleware?.next?.next?.next?.next?.next?.next?.next instanceof CustomFetchHandler);
});

it("Should maintain the middleware array order", () => {
Expand Down

0 comments on commit 1d57fb2

Please sign in to comment.