Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerResponse should allow the usage of unassigned HTTP status codes [SPR-16366] #20913

Closed
spring-issuemaster opened this issue Jan 11, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jan 11, 2018

Jiří Pauer opened SPR-16366 and commented

Hello,

the current implementation of the ServerResponse does not allow the usage of unassigned HTTP status codes, because of the HttpStatus enum which contains only IANA registered HTTP Status codes.

But the HTTP specification allows the usage of new/extension/unassigned status codes. See: http://tools.ietf.org/html/rfc7231#section-6 and http://tools.ietf.org/html/rfc7231#section-8.2.2
Unfortunately, custom status codes are sometimes used by RESTful APIs.

It would be nice if the ServerResponse would allow custom status codes. The ServerResponse needs a constructor or builder method which excepts custom status codes.

The IANA list shows the codes which are unassigned:
http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml


Affects: 5.0.2

Issue Links:

  • #20622 Returning non-standard HTTP status code causes exceptions on WebFlux
  • #18779 ResponseEntity should allow the usage of unassigned HTTP status codes
  • #21289 No support for non-standard HTTP status codes in reactive ClientHttpResponse

Referenced from: commits 9623cde

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 11, 2018

Juergen Hoeller commented

Indeed, the underlying ServerHttpResponse abstraction supports this already... and so does ResponseEntity in Spring MVC. The functional WebFlux usage model should join the club here.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 11, 2018

Jiří Pauer commented

Perfect.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 14, 2018

Juergen Hoeller commented

Status codes can be specified as int values on all functional builder variants now, along the lines of ResponseEntity and co.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.