-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(interceptor): change getter methods to getter properties (#490…
…) (#636) ### Refactoring - [interceptor] Changed getter methods to getter properties, as a way to simplify the Zimic API. #### `HttpInterceptor` | Previously | Now | | ------------------------- | ----------------------- | | `interceptor.baseURL()` | `interceptor.baseURL` | | `interceptor.platform()` | `interceptor.platform` | | `interceptor.isRunning()` | `interceptor.isRunning` | #### `HttpRequestHandler` | Previously | Now | | -------------------- | ------------------ | | `handler.method()` | `handler.method` | | `handler.path()` | `handler.path` | | `handler.requests()` | `handler.requests` | #### `InterceptorServer` | Previously | Now | | ------------------------------- | ----------------------------- | | `server.hostname()` | `server.hostname` | | `server.port()` | `server.port` | | `server.logUnhandledRequests()` | `server.logUnhandledRequests` | | `server.httpURL()` | `server.httpURL` | | `server.isRunning()` | `server.isRunning` | > [!IMPORTANT] > > For remote interceptors, `await handler.requests()` was the way to access the intercepted requests. Now, you can access the requests in both local and remote interceptors by using `handler.requests`, without needing to await. Part of #490.
- Loading branch information
1 parent
6f915b2
commit 8c02f7f
Showing
60 changed files
with
1,548 additions
and
1,936 deletions.
There are no files selected for viewing
491 changes: 246 additions & 245 deletions
491
apps/zimic-test-client/tests/fetch/FetchClient.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
434 changes: 216 additions & 218 deletions
434
apps/zimic-test-client/tests/interceptor/thirdParty/shared/httpInterceptor.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { expect } from 'vitest'; | ||
|
||
export function expectResponseStatus<Response extends globalThis.Response, Status extends Response['status']>( | ||
response: Response, | ||
status: Status, | ||
): asserts response is Extract<Response, { status: Status }> { | ||
expect(response.status).toBe(status); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.