You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add option ignoreTrailingSlash to MockAgent and .intercept() (nodejs#3655)
* fix: mock interceptor should ignore trailing slashes
* only normalize path if it is a string
* put tests into mock-interceptors.js
* make ignoreTrailingSlashes an option of MockAgent
* rename to ignoreTrailingSlash
* make ignoreTrailingSlashes an option of .intercept
* Apply suggestions from code review
* add documentation
Copy file name to clipboardExpand all lines: docs/docs/api/MockPool.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,7 @@ Returns: `MockInterceptor` corresponding to the input options.
58
58
***body**`string | RegExp | (body: string) => boolean` - (optional) - a matcher for the HTTP request body.
59
59
***headers**`Record<string, string | RegExp | (body: string) => boolean`> - (optional) - a matcher for the HTTP request headers. To be intercepted, a request must match all defined headers. Extra headers not defined here may (or may not) be included in the request and do not affect the interception in any way.
60
60
***query**`Record<string, any> | null` - (optional) - a matcher for the HTTP request query string params. Only applies when a `string` was provided for `MockPoolInterceptOptions.path`.
61
+
***ignoreTrailingSlash**`boolean` - (optional) - set to `true` if the matcher should also match by ignoring potential trailing slashes in `MockPoolInterceptOptions.path`.
0 commit comments