Skip to content

Commit

Permalink
Dispatch turbo:before-fetch-request with URL
Browse files Browse the repository at this point in the history
Dispatch `turbo:before-fetch-request` with a direct reference to the
`FetchRequest` instance's `url: URL` property as part of the
`event.detail`.
  • Loading branch information
seanpdoyle committed Nov 22, 2021
1 parent 4a9f220 commit af46cc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/http/fetch_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class FetchRequest {
cancelable: true,
detail: {
fetchOptions,
url: this.url.href,
url: this.url,
resume: this.resolveRequestPromise
},
target: this.target as EventTarget
Expand Down
2 changes: 1 addition & 1 deletion src/tests/functional/visit_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class VisitTests extends TurboDriveTestCase {
const { url, fetchOptions } = await this.nextEventNamed("turbo:before-fetch-request")

this.assert.equal(fetchOptions.method, "GET")
this.assert.include(url, "/src/tests/fixtures/one.html")
this.assert.ok(url.toString().includes("/src/tests/fixtures/one.html"))
}

async "test turbo:before-fetch-response open new site"() {
Expand Down

0 comments on commit af46cc1

Please sign in to comment.