Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelolx committed Sep 3, 2024
1 parent 25324b0 commit f690a98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Accepts `Object`, `FormData` or `URLSearchParams`.

Specifies which response format will be accepted. Default is `html`.

Options are `html`, `turbo-stream`, `json`.
Options are `html`, `turbo-stream`, `json`, and `script`.

#### Turbo Streams

Expand All @@ -115,6 +115,12 @@ window.Turbo = Turbo

Since [v7.0.0-beta.6](https://github.com/hotwired/turbo/releases/tag/v7.0.0-beta.6) Turbo sets `window.Turbo` automatically.

Request.JS will also use Turbo's `fetch` to include the `X-Turbo-Request-ID` header in the request (see [#73](https://github.com/rails/request.js/issues/73)).

#### Script Responses

Request.JS will automatically activate script tags in the response (see [#48](https://github.com/rails/request.js/issues/48)).

#### Request Interceptor

To authenticate fetch requests (eg. with Bearer token) you can use request interceptor. It allows pausing request invocation for fetching token and then adding it to headers:
Expand Down

0 comments on commit f690a98

Please sign in to comment.