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
Defined in: [src/index.ts:299](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L299)
11
+
Defined in: [src/index.ts:298](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L298)
12
12
13
13
Uses Next's internal `apiResolver` (for Pages Router) or an
14
14
`AppRouteRouteModule` instance (for App Router) to execute api route handlers
Copy file name to clipboardExpand all lines: docs/src/interfaces/NtarhInit.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
# Interface: NtarhInit\<NextResponseJsonType\>
8
8
9
-
Defined in: [src/index.ts:133](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L133)
9
+
Defined in: [src/index.ts:132](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L132)
10
10
11
11
## Extended by
12
12
@@ -25,7 +25,7 @@ Defined in: [src/index.ts:133](https://github.com/Xunnamius/next-test-api-route-
25
25
26
26
> `optional`**rejectOnHandlerError**: `boolean`
27
27
28
-
Defined in: [src/index.ts:146](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L146)
28
+
Defined in: [src/index.ts:145](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L145)
29
29
30
30
If `false`, errors thrown from within a handler are kicked up to Next.js's
31
31
resolver to deal with, which is what would happen in production. If `true`,
Defined in: [src/index.ts:152](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L152)
51
+
Defined in: [src/index.ts:151](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L151)
52
52
53
53
`test` is a function that runs your test assertions. This function receives
54
54
one destructured parameter: `fetch`, which is equivalent to
Defined in: [src/index.ts:163](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L163)
9
+
Defined in: [src/index.ts:162](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L162)
10
10
11
11
The parameters expected by `testApiHandler` when using `appHandler`.
12
12
@@ -26,7 +26,7 @@ The parameters expected by `testApiHandler` when using `appHandler`.
26
26
27
27
> **appHandler**: `Partial`\<`Omit`\<`AppRouteUserlandModule`, keyof `AppRouteHandlers`\> & `{ [key in keyof AppRouteHandlers]?: (req: NextRequest, segmentData?: any) => any }`\>
28
28
29
-
Defined in: [src/index.ts:172](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L172)
29
+
Defined in: [src/index.ts:171](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L171)
30
30
31
31
The actual App Router route handler under test. It should be an object
32
32
containing one or more async functions named for valid HTTP methods and/or
@@ -40,15 +40,15 @@ for details.
40
40
41
41
> `optional`**pagesHandler**: `undefined`
42
42
43
-
Defined in: [src/index.ts:183](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L183)
43
+
Defined in: [src/index.ts:182](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L182)
Defined in: [src/index.ts:193](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L193)
51
+
Defined in: [src/index.ts:192](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L192)
52
52
53
53
`params` is passed directly to the handler and represents processed dynamic
54
54
routes. This should not be confused with query string parsing, which is
Defined in: [src/index.ts:203](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L203)
67
+
Defined in: [src/index.ts:202](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L202)
68
68
69
69
A function that receives `params`, an object representing "processed"
70
70
dynamic route parameters. Modifications to `params` are passed directly to
@@ -90,7 +90,7 @@ is handled by `Request` automatically.
90
90
91
91
> `optional`**rejectOnHandlerError**: `boolean`
92
92
93
-
Defined in: [src/index.ts:146](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L146)
93
+
Defined in: [src/index.ts:145](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L145)
94
94
95
95
If `false`, errors thrown from within a handler are kicked up to Next.js's
96
96
resolver to deal with, which is what would happen in production. If `true`,
Defined in: [src/index.ts:215](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L215)
120
+
Defined in: [src/index.ts:214](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L214)
121
121
122
122
A function that receives a `NextRequest` object and returns a `Request`
123
123
instance. Use this function to edit the request _before_ it's injected
Defined in: [src/index.ts:228](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L228)
146
+
Defined in: [src/index.ts:227](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L227)
147
147
148
148
A function that receives the `Response` object returned from `appHandler`
149
149
and returns a `Response` instance. Use this function to edit the response
Defined in: [src/index.ts:152](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L152)
173
+
Defined in: [src/index.ts:151](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L151)
174
174
175
175
`test` is a function that runs your test assertions. This function receives
176
176
one destructured parameter: `fetch`, which is equivalent to
@@ -198,7 +198,7 @@ one destructured parameter: `fetch`, which is equivalent to
198
198
199
199
> `optional`**url**: `string`
200
200
201
-
Defined in: [src/index.ts:233](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L233)
201
+
Defined in: [src/index.ts:232](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L232)
202
202
203
203
`url: 'your-url'` is shorthand for `requestPatcher: (request) => new
Defined in: [src/index.ts:239](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L239)
9
+
Defined in: [src/index.ts:238](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L238)
10
10
11
11
The parameters expected by `testApiHandler` when using `pagesHandler`.
12
12
@@ -26,15 +26,15 @@ The parameters expected by `testApiHandler` when using `pagesHandler`.
26
26
27
27
> `optional`**appHandler**: `undefined`
28
28
29
-
Defined in: [src/index.ts:251](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L251)
29
+
Defined in: [src/index.ts:250](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L250)
Defined in: [src/index.ts:250](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L250)
37
+
Defined in: [src/index.ts:249](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L249)
38
38
39
39
The actual Pages Router route handler under test. It should be an async
40
40
function that accepts `NextApiRequest` and `NextApiResult` objects (in
Defined in: [src/index.ts:261](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L261)
53
+
Defined in: [src/index.ts:260](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L260)
54
54
55
55
`params` is passed directly to the handler and represents processed dynamic
56
56
routes. This should not be confused with query string parsing, which is
Defined in: [src/index.ts:271](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L271)
69
+
Defined in: [src/index.ts:270](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L270)
70
70
71
71
A function that receives `params`, an object representing "processed"
72
72
dynamic route parameters. Modifications to `params` are passed directly to
@@ -92,7 +92,7 @@ is handled automatically.
92
92
93
93
> `optional`**rejectOnHandlerError**: `boolean`
94
94
95
-
Defined in: [src/index.ts:146](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L146)
95
+
Defined in: [src/index.ts:145](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L145)
96
96
97
97
If `false`, errors thrown from within a handler are kicked up to Next.js's
98
98
resolver to deal with, which is what would happen in production. If `true`,
Defined in: [src/index.ts:281](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L281)
122
+
Defined in: [src/index.ts:280](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L280)
123
123
124
124
A function that receives an `IncomingMessage` object. Use this function
125
125
to edit the request _before_ it's injected into the handler.
Defined in: [src/index.ts:286](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L286)
146
+
Defined in: [src/index.ts:285](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L285)
147
147
148
148
A function that receives a `ServerResponse` object. Use this function
149
149
to edit the response _before_ it's injected into the handler.
@@ -164,7 +164,7 @@ to edit the response _before_ it's injected into the handler.
Defined in: [src/index.ts:152](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L152)
167
+
Defined in: [src/index.ts:151](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L151)
168
168
169
169
`test` is a function that runs your test assertions. This function receives
170
170
one destructured parameter: `fetch`, which is equivalent to
@@ -192,7 +192,7 @@ one destructured parameter: `fetch`, which is equivalent to
192
192
193
193
> `optional`**url**: `string`
194
194
195
-
Defined in: [src/index.ts:291](https://github.com/Xunnamius/next-test-api-route-handler/blob/2864e3a2c10a43eec470c473dcbdc6e9599cfee3/src/index.ts#L291)
195
+
Defined in: [src/index.ts:290](https://github.com/Xunnamius/next-test-api-route-handler/blob/e9d6c65a2563c98f0367b0ff43cd7ea952acf10a/src/index.ts#L290)
196
196
197
197
`url: 'your-url'` is shorthand for `requestPatcher: (req) => { req.url =
0 commit comments