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

Properly resolve HTTP methods #1767

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d0vi
Copy link

@d0vi d0vi commented Jan 31, 2024

On Spring Framework 5 HttpMethod is an enum type that exposes a resolve(java.lang.String) method that matches the String value passed with the enum value while handling null values gracefully. However, in the context of toValidHttpMethod(java.lang.String), there is a previous assertion that ensures null will not be passed moving forward. Hence, using enum's native valueOf directly seems like a good idea.

Furthermore, Spring Framework 6.0 marked HttpMethod#resolve(java.lang.String) as deprecated for removal, and starting from Spring Framework 6.1 this API element no longer exists. This change is currently causing issues (#1760) with latest Spring Framework and Spring Boot versions.

This commit replaces the use of this method with the equivalent HttpMethod#valueOf(java.lang.String).

Closes #1760.

@d0vi d0vi force-pushed the replace-deprecated-httpmethod-resolve branch from 6ccb0a4 to ee48bd0 Compare January 31, 2024 14:20
@d0vi d0vi changed the title Future-proof the code that resolves HTTP methods Properly resolve HTTP methods Apr 1, 2024
On Spring Framework 5 `HttpMethod` is an enum type that exposes a `resolve(java.lang.String)` method that matches the String value passed with the enum value while handling null values gracefully. However, in the context of `toValidHttpMethod(java.lang.String)`, there is a previous assertion that ensures `null` will not be passed moving forward. Hence, using enum's native `valueOf` directly seems like a good idea.

Furthermore, Spring Framework 6.0 marked `HttpMethod#resolve(java.lang.String)` as deprecated for removal, and starting from Spring Framework 6.1 this API element no longer exists. This change is currently causing issues (rest-assured#1760) with latest Spring Framework and Spring Boot versions.

This commit replaces the use of this method with the equivalent `HttpMethod#valueOf(java.lang.String)`.

Closes rest-assured#1760.
@d0vi d0vi force-pushed the replace-deprecated-httpmethod-resolve branch from ee48bd0 to 35e02f1 Compare April 1, 2024 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error java.lang.NoSuchMethodError for HttpMethod.resolve().
1 participant