Headers POST request Turbo Stream response failing
Closed this issue · 1 comments
seans84 commented
I cannot get requestjs to submit the appropriate headers by default to be automatically detected by rails.
When I setup a request like this
await post("/my_url", {
responseKind: "turbo-stream",
body: JSON.stringify({
attr_1: "something"
}),
})
It sends seemingly the correct headers, but not the one required by turbo-rails to detect that it is a turbo request.
request.headers["HTTP_ACCEPT"] => "text/vnd.turbo-stream.html, text/html, application/xhtml+xml"
request.headers["HTTP_X_TURBO_REQUEST_ID"] => "bc6139cd-35b2-4cb6-953d-c43255ac814d"
request.headers["Turbo-Frame"] => nil
seans84 commented
PEBKAC error on my end. I had my view named incorrectly (create.turbo_stream.html.erb instead of create.turbo_stream.erb) which resulted in my issue.