Skip to content

Commit 8348274

Browse files
authored
fix(fetch): cloned response return correct url (#2852)
1 parent eff7318 commit 8348274

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"main": "./index.js",
2323
"types": "types",
2424
"dependencies": {
25-
"@mswjs/interceptors": "^0.38.0",
25+
"@mswjs/interceptors": "^0.38.1",
2626
"json-stringify-safe": "^5.0.1",
2727
"propagate": "^2.0.0"
2828
},

tests/test_fetch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ describe('Native Fetch', () => {
166166
await fetch('https://api.test.com/data', { headers })
167167
})
168168

169+
it('should return a url for cloned response URL ', async () => {
170+
const scope = nock('http://example.test').get('/').reply()
171+
172+
const response = await fetch(new URL('http://example.test/'))
173+
expect(response.clone().url).to.equal('http://example.test/')
174+
scope.done()
175+
})
176+
169177
describe('content-encoding', () => {
170178
it('should accept gzipped content', async () => {
171179
const message = 'Lorem ipsum dolor sit amet'

0 commit comments

Comments
 (0)