Is there a way to make lazy Turbo Frames accept `text/vnd.turbo-stream.html`?

I have a lazy Turbo Frame, roughly like this:

<turbo-frame id="this-frame" src="/my/cool/url" loading="lazy" />

When that frame is visible, a request is made to the server. Among other things, the request headers contain:

Accept: text/html, application/xhtml+xml
Turbo-Frame: this-frame

Right now, my code looks for that Turbo-Frame header to decide if it should return a focused amount of data via a Turbo Stream or the whole page as straight HTML.

This works, but it feels weird that this part of my app looks for the Turbo-Frame header while other endpoints look for the Accept header to contain text/vnd.turbo-stream.html. Is there a way to add that content type to the request made by the lazy frame request?

1 Like