hotwired / turbo-site

turbo.hotwired.dev web site
83 stars 102 forks source link

Document the expected HTTP status codes #111

Closed kuba-orlik closed 2 years ago

kuba-orlik commented 2 years ago

Turbo expects the server to respond with a 303 status code on successful form submission, but it's not mentioned anywhere in the Turbo Reference or Handbook (https://turbo.hotwired.dev/reference/drive). Same goes for the 422 status code when you want to render a form error state.

I've invited some people to use Turbo and the status code nuances really negatively impacted their learning curve (they did not use Turbo in conjunction with Rails)

seanpdoyle commented 2 years ago

Thank you for opening this issue @kuba-orlik!

The "Redirecting After a Form Submission" heading in the "Navigate with Turbo Drive" section of the Turbo Handbook mentions both the 303 See other and 422 Unprocessible entity status codes.

What kinds of improvements to that section or the Reference would make that information more discoverable?

kuba-orlik commented 2 years ago

Ah, sorry about that. I manually did ctrl+f for "422" on most of the subpages and must've missed https://turbo.hotwired.dev/handbook/drive. My bad. Thanks for a fast response! <3