gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.07k stars 573 forks source link

meta issue for empty response status issue #2339

Closed sio4 closed 1 year ago

sio4 commented 1 year ago

Summary

From the definition of buffalo Handler: https://pkg.go.dev/github.com/gobuffalo/buffalo#Handler

It is the responsibility of the Handler to handle the request/response correctly.

However, the responsibility of setting the status code on a response is slightly tricky, since the behavior of the standard ResponseWriter allows developers can omit the status code when it is 200. Even though we can have our own policy, aligning with the standard library could be the best for developers so they can expect the same behavior.

This issue is not just about responsibility but it affects the consistency of request processing. When if the developer omits the status code on their response,

I think the direction should be aligned with the standard library, so we need to fix:

Related issues and PRs

Related discussions:

@gobuffalo/core-managers what do you think? any other opinions? This is a behavior change, but I don't think it will break existing apps widely. I will work on it if you have no concerns.