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

deprecate HttpResponse::getStatus #11284

Merged
merged 8 commits into from
Nov 8, 2024
Merged

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Oct 29, 2024

This pull-request deprecates HttpResponse::getStatus and HttpClientResponseException::getStatus. It adds HttpClientResponseException::code, and HttpClientResponseException::reason methods.

In order to be custom status codes compatible is better for people to use HttpResponse::code instead of HttpResponse::getStatus.

For example, we hit an issue in Micrometer micronaut-projects/micronaut-micrometer#857

I have annotated the method as deprecated but not for removal. I don’t think we should remove it as it will break a lot of apps and tests.

This pull-request deprecates `HttpResponse::getStatus` and `HttpClientResponseException::getStatus`. It adds `HttpClientResponseException::code`, and `HttpClientResponseException::reason` methods.

In order to be custom status codes compatible is better for people to use `HttpResponse::code` instead of `HttpResponse::getStatus`.

For example, we hit an issue in Micrometer micronaut-projects/micronaut-micrometer#857

I have annotated the method as deprecated but not for removal. I don’t think we should remove it as it will break a lot of apps and tests.
@sdelamo sdelamo added the type: improvement A minor improvement to an existing feature label Oct 29, 2024
@graemerocher
Copy link
Contributor

I think this will be a large and disruptive deprecation for a lot of codebases. Not sure it is worth deprecating to be honest

@yawkat
Copy link
Member

yawkat commented Oct 30, 2024

I think we should avoid getStatus in framework code, but for most users, it's not really a problem to use because they don't use custom status types in the first place.

@sdelamo
Copy link
Contributor Author

sdelamo commented Oct 30, 2024

I think we should avoid getStatus in framework code.

The problem is how to convey this to @micronaut-projects/core-developers without deprecating it.

@sdelamo
Copy link
Contributor Author

sdelamo commented Oct 30, 2024

@graemerocher @yawkat I have removed the deprecation but kept the javadoc clarifications. Can you re-review?

Copy link

@sdelamo sdelamo merged commit 173a6a4 into 4.7.x Nov 8, 2024
21 checks passed
@sdelamo sdelamo deleted the deprecate-http-response-status branch November 8, 2024 09:21
PeterFokkinga pushed a commit to PeterFokkinga/micronaut-core that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants