Skip to content

Commit d91b4db

Browse files
committed
Fix typo in fixtures mock-server
1 parent 81f3442 commit d91b4db

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

packages/openapi-fetch/test/fixtures/mock-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const server = setupServer();
2121
export const baseUrl = "https://api.example.com" as const;
2222

2323
/**
24-
* Test path helper, returns a an absolute URL based on
24+
* Test path helper, returns an absolute URL based on
2525
* the given path and base
2626
*/
2727
export function toAbsoluteURL(path: string, base: string = baseUrl) {

packages/openapi-react-query/test/fixtures/mock-server.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const server = setupServer();
2121
export const baseUrl = "https://api.example.com" as const;
2222

2323
/**
24-
* Test path helper, returns a an absolute URL based on
24+
* Test path helper, returns an absolute URL based on
2525
* the given path and base
2626
*/
2727
export function toAbsoluteURL(path: string, base: string = baseUrl) {
@@ -97,23 +97,20 @@ export function useMockRequestHandler<
9797
const resolvedPath = toAbsoluteURL(path, requestBaseUrl);
9898

9999
server.use(
100-
http[method]<Params, RequestBodyType, ResponseBodyType>(
101-
resolvedPath,
102-
(args) => {
103-
requestUrl = args.request.url;
104-
receivedRequest = args.request.clone();
105-
receivedCookies = { ...args.cookies };
106-
107-
if (handler) {
108-
return handler(args);
109-
}
110-
111-
return HttpResponse.json(body as any, {
112-
status: status ?? 200,
113-
headers,
114-
}) as AsyncResponseResolverReturnType<ResponseBodyType>;
115-
},
116-
),
100+
http[method]<Params, RequestBodyType, ResponseBodyType>(resolvedPath, (args) => {
101+
requestUrl = args.request.url;
102+
receivedRequest = args.request.clone();
103+
receivedCookies = { ...args.cookies };
104+
105+
if (handler) {
106+
return handler(args);
107+
}
108+
109+
return HttpResponse.json(body as any, {
110+
status: status ?? 200,
111+
headers,
112+
}) as AsyncResponseResolverReturnType<ResponseBodyType>;
113+
}),
117114
);
118115

119116
return {

0 commit comments

Comments
 (0)