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

[4.x] Missing Http Status codes for 421...429,431,451 #7343

Closed
rob-bygrave opened this issue Aug 8, 2023 · 5 comments
Closed

[4.x] Missing Http Status codes for 421...429,431,451 #7343

rob-bygrave opened this issue Aug 8, 2023 · 5 comments
Assignees
Milestone

Comments

@rob-bygrave
Copy link

Environment Details

  • Helidon Version: 4.0-M1
  • Helidon SE
  • JDK version: 20
  • OS: MacOS

Problem Description

io.helidon.common.http.Http.Status has public static fields for the Http status codes. In the 400 range it stops at 418 and the status codes for 421, 422, 423 ... 429, 431, 451 are missing.

Refer: https://github.com/helidon-io/helidon/blob/main/common/http/src/main/java/io/helidon/common/http/Http.java#L551

Suggested fix

Add entries in https://github.com/helidon-io/helidon/blob/main/common/http/src/main/java/io/helidon/common/http/Http.java for the status codes: 421, 422, 423 ... 429, 431, 451

@rob-bygrave rob-bygrave changed the title [4.x] Missing Http Status codes for 421...429,431,451 in io.helidon.common.http.Http.Status [4.x] Missing Http Status codes for 421...429,431,451 Aug 8, 2023
@tomas-langer
Copy link
Member

I am not for including every code listed - the codes we have in Helidon are part of specifications. It would be nice to have a clear understanding which RFC defines that status code.
For example 421, 422, 426 are part of RFC 9110
428, 429 etc. are part of RFC 6585 which seems to be a "proposed standard" (not final stage)
451 - RFC 7725 (although I like the Monty Python reference, not sure this is a widely used code - some investigation required)

@tomas-langer
Copy link
Member

A reasonable list of status codes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451

@rob-bygrave
Copy link
Author

rob-bygrave commented Aug 9, 2023

I am not for including every code listed

FWIW I'm fine with not adding them all. The missing codes I expect to use myself and would really love to see added are 422, 423, 429 and maybe 428.

  • 422 Unprocessable Content (Typically a validation error on the input content)
  • 423 Locked
  • 429 Too Many Requests

With these 3 added (plus maybe 428?) I'd be content.

FYI: Background motivation:
There is a performance benefit of using the pre-defined Http.Status values plus some documentation benefit for people reading the code rather than seeing an int value. I have code generation library (annotation processor) that will use the pre-defined Http.Status if they exist.

Edit:
BTW I really love the codes having the reason PLUS code like OK_200, CONFLICT_409 etc. I think that is really nice in the way it will assist devs less familiar with the http status codes learn and understand them - a really nice little touch imo.

@m0mus m0mus added this to the 4.0.0 milestone Aug 10, 2023
@tomas-langer tomas-langer self-assigned this Aug 21, 2023
@tomas-langer
Copy link
Member

I have added the requested statuses, PR is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants