Skip to content

Commit 9214db3

Browse files
committed
added response object in fetch return
1 parent c942349 commit 9214db3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

mod.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export const makeFetch = (h: HandlerOrListener) => {
8989
const resp = makeFetchPromise(h)
9090
async function fetch(url: string | URL, options?: RequestInit) {
9191
const { data, res } = await resp(url, options)
92+
9293
const expectStatus = (a: number, b?: string) => {
9394
assertEquals(
9495
res.status,
@@ -102,7 +103,7 @@ export const makeFetch = (h: HandlerOrListener) => {
102103
expect: expectAll,
103104
expectStatus,
104105
expectHeader,
105-
expectBody,
106+
expectBody
106107
}
107108
}
108109
const expectHeader = (a: string, b: string | RegExp | null | string[]) => {
@@ -141,7 +142,7 @@ export const makeFetch = (h: HandlerOrListener) => {
141142
expect: expectAll,
142143
expectStatus,
143144
expectHeader,
144-
expectBody,
145+
expectBody
145146
}
146147
}
147148
const expectBody = (a: unknown) => {
@@ -168,6 +169,7 @@ export const makeFetch = (h: HandlerOrListener) => {
168169
expectStatus,
169170
expectHeader,
170171
expectBody,
172+
...res
171173
}
172174
}
173175
return fetch

0 commit comments

Comments
 (0)