2021-11-23 11:45:18 -05:00
|
|
|
Deno.test(
|
2021-09-13 14:19:10 -04:00
|
|
|
{ perms: { net: true } },
|
|
|
|
async function responseClone() {
|
|
|
|
const response =
|
|
|
|
await fetch(
|
2022-09-19 10:32:21 -04:00
|
|
|
'http://localhost:4545/assets/fixture.json',
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|
2021-09-13 14:19:10 -04:00
|
|
|
const response1 =
|
2023-01-24 15:07:00 -05:00
|
|
|
response.clone()
|
2021-09-13 14:19:10 -04:00
|
|
|
assert(
|
|
|
|
response !==
|
|
|
|
response1,
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|
2021-09-13 14:19:10 -04:00
|
|
|
assertEquals(
|
|
|
|
response.status,
|
|
|
|
response1
|
|
|
|
.status,
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|
2021-09-13 14:19:10 -04:00
|
|
|
assertEquals(
|
|
|
|
response.statusText,
|
|
|
|
response1
|
|
|
|
.statusText,
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|
2021-09-13 14:19:10 -04:00
|
|
|
const u8a =
|
2024-05-22 20:27:58 -04:00
|
|
|
await response
|
|
|
|
.bytes()
|
2021-09-13 14:19:10 -04:00
|
|
|
const u8a1 =
|
2024-05-22 20:27:58 -04:00
|
|
|
await response1
|
|
|
|
.bytes()
|
2021-09-13 14:19:10 -04:00
|
|
|
for (
|
|
|
|
let i = 0;
|
|
|
|
i <
|
|
|
|
u8a.byteLength;
|
|
|
|
i++
|
|
|
|
) {
|
|
|
|
assertEquals(
|
|
|
|
u8a[i],
|
|
|
|
u8a1[i],
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|
2021-09-13 14:19:10 -04:00
|
|
|
}
|
|
|
|
},
|
2023-01-24 15:07:00 -05:00
|
|
|
)
|