3

I have a basic JSON error responder:

format.json { render json: errors, status: :unprocessable_entity }

In development, running Puma, I get back:

Status Code: 422 Unprocessable Entity

In production, running Unicorn, I get back:

Status Code: 422

Can anyone think of a reason that the message would be missing?

2
  • I guess it depends on web server and not on Rails Commented May 3, 2018 at 17:16
  • 2
    Note that HTTP/2 doesn't have reason phrases anymore. Commented May 3, 2018 at 17:24

2 Answers 2

1

Rails sending HTTP status code without status message

is the correct answer in this case.

Once I switched on the 'Protocol' column in Chrome Dev Tools, I was able to see that I was using HTTP/2, which would explain the lack of reason phrases.

toggle protocol column

h2

Thank you Julian Reschke.

Sign up to request clarification or add additional context in comments.

Comments

0

It is server and http version related. It will differ from your local and production servers.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.