Skip to content

Replace hardcoded GET method with HttpMethod.GET for better readability #33634

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

Closed
wants to merge 1 commit into from

Conversation

junhyeongkim2
Copy link
Contributor

Changes

  • Replaced the hardcoded "GET" string comparison in the matchWebSocketUpgrade method with HttpMethod.GET.matches(request.getMethod()).
  • This change improves code readability and prevents potential errors caused by hardcoded strings.
  • It also aligns with Spring's convention for handling HTTP method matching, providing a more consistent approach.
  • Noticed that HttpMethod.GET.matches is used in other parts of the codebase, so this change also improves overall consistency.

Reason

  • Using constants from Spring's HttpMethod class enhances the maintainability of the code.
  • Avoiding hardcoded strings reduces the risk of typos and other potential errors.
  • Ensuring consistency across the codebase by using the same method for HTTP method matching where applicable.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 2, 2024
@snicoll
Copy link
Member

snicoll commented Oct 4, 2024

@junhyeongkim2 thanks for the PR. We're a little puzzled by the amount of text for a one-liner change. We've noticed a number of such PRs in the recent past. Is this some sort of school assignment perhaps?

I am asking as we're a small team with limited time and we need to chose what we're working on wisely.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Oct 4, 2024
@junhyeongkim2
Copy link
Contributor Author

@snicoll
Hello, thank you for your reply. This is not a school project, I'm contributing to open source personally because I have deep respect for the Spring Boot project. Due to my limited experience, I felt the need to over-explain, which made the content longer than necessary. I apologize for this. Moving forward, I'll focus on conveying only the key details to respect your team's time. I appreciate your patience and guidance.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 4, 2024
@snicoll snicoll added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Oct 4, 2024
@snicoll snicoll added this to the 6.1.14 milestone Oct 4, 2024
@snicoll snicoll self-assigned this Oct 4, 2024
snicoll pushed a commit that referenced this pull request Oct 4, 2024
@snicoll snicoll closed this in c41f8ea Oct 4, 2024
@snicoll
Copy link
Member

snicoll commented Oct 4, 2024

@junhyeongkim2 thanks for following up and congratulations on making your first contribution to the Spring Framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants