spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
55.76k stars 37.81k forks source link

Update HttpStatus to align with RFC9110 where relevant #32870

Open DidierLoiseau opened 2 months ago

DidierLoiseau commented 2 months ago

Affects: 6.1

The HttpStatus javadoc links to HTTP Status Code Registry, which in turn refers to RFC9110 (published in June 2022). However the detailed documentation for HttpStatus’s values still refer to RFC7231, which was obsoleted by the former.

Some statuses have been updated. In particular, statuses 421 & 422 which used to be part of WebDav are now part of this RFC. I didn’t check for all statuses or other usages in the documentation.

simonbasle commented 1 month ago

Other changes that I could spot looking at https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml are:

simonbasle commented 1 month ago

We discussed this as a team and we feel such a refresh would best be done after the 6.2.x timeframe, at a minimum. This would imply a full pass on HttpStatus to deprecate codes, introduce new ones and refresh the links in the javadocs.

DidierLoiseau commented 1 month ago

@simonbasle It’s the first time I hear about Spring 7, wouldn’t it make sense to already deprecate those which should be, so that you can change them in 7? I guess 7 is still far away, isn’t it?

Also wouldn’t it be possible to add the new ones already if they don’t clash with anything, so that users don’t have to wait for 7?

(I agree this is a nice to have for now since raw status codes can be used too, but on the other hand RFC 9110 is already 2 years old)

simonbasle commented 1 month ago

yes, sorry, I should have said "after the 6.2.x timeframe, at a minimum". In the meantime, I'd recommend using the raw codes or HttpStatusCode.valueOf(int) as a way of dealing with both known and unknown codes.

snicoll commented 1 month ago

An issue can't be both an enhancement and a documentation so I've removed the former. @simonbasle can you please rephrase the title to properly describe the enhancement? Thanks!