Skip to content

Support URL objects #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions __tests__/fetch_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ test('treat method name case-insensitive', async () => {
}
})

test('casts URL to String', async () => {
const testRequest = new FetchRequest("GET", new URL("http://localhost"))
expect(typeof testRequest.originalUrl).toBe("string")
})

describe('header handling', () => {
const defaultHeaders = {
'X-Requested-With': 'XMLHttpRequest',
Expand Down
2 changes: 1 addition & 1 deletion src/fetch_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class FetchRequest {
constructor (method, url, options = {}) {
this.method = method
this.options = options
this.originalUrl = url
this.originalUrl = url.toString()
}

async perform () {
Expand Down