Skip to content

Commit 6698d24

Browse files
authored
Support URL objects (#39)
* Merge upstream * Support URL objects in FetchRequest. Fixes #38
1 parent 183ed3a commit 6698d24

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

__tests__/fetch_request.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ test('treat method name case-insensitive', async () => {
6666
}
6767
})
6868

69+
test('casts URL to String', async () => {
70+
const testRequest = new FetchRequest("GET", new URL("http://localhost"))
71+
expect(typeof testRequest.originalUrl).toBe("string")
72+
})
73+
6974
describe('header handling', () => {
7075
const defaultHeaders = {
7176
'X-Requested-With': 'XMLHttpRequest',

src/fetch_request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class FetchRequest {
66
constructor (method, url, options = {}) {
77
this.method = method
88
this.options = options
9-
this.originalUrl = url
9+
this.originalUrl = url.toString()
1010
}
1111

1212
async perform () {

0 commit comments

Comments
 (0)