Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add CharSequence overloads for putHeader methods in HttpRequest#2783

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Vynbz wants to merge1 commit intovert-x3:master
base:master
Choose a base branch
Loading
fromVynbz:feat/charsequence-header-names

Conversation

@Vynbz
Copy link

Motivation

As discussed in#2770, theHttpServerResponse interface in vertx-core already provides CharSequence overloads for header methods, but the web client'sHttpRequest interface only accepts String parameters. This inconsistency means users need to convert CharSequence values (like Netty'sHttpHeaderNames constants) to Strings unnecessarily.

@vietjvietj added this to the5.1.0 milestoneAug 30, 2025
@Vynbz
Copy link
Author

WhileputHeader(CharSequence, CharSequence) works fine, addingputHeader(CharSequence, Iterable<CharSequence>) causes ambiguous method call errors with existing code. Should I proceed with just the single-value overload, or would you prefer a different approach?

Copy link
Member

@tsegismonttsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@Vynbz thanks for the PR.

*/
@Fluent
@GenIgnore(GenIgnore.PERMITTED_TYPE)
HttpRequest<T>putHeader(CharSequencename,CharSequencevalue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you create a default implementation that converts toString?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've updated the implementation to use interface default methods as you suggested

@tsegismont
Copy link
Member

WhileputHeader(CharSequence, CharSequence) works fine, addingputHeader(CharSequence, Iterable<CharSequence>) causes ambiguous method call errors with existing code. Should I proceed with just the single-value overload, or would you prefer a different approach?

Please go ahead and add the method. You can updateWebClientTest for ambiguous method calls.

Copy link
Member

@tsegismonttsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the updates@Vynbz

In fact, I was suggesting to add default implementations, so that existing implementations in other projects don't break with the new release.

But in our project, we must implement these new methods in an efficient manner (always converting to string defeats the original purpose of this PR)

@Vynbz
Copy link
Author

@tsegismont thanks for review

Just to make sure I understand correctly before I push the changes - you want me to keep the default implementations in the HttpRequest interface, but also keep efficient override implementations in HttpRequestImpl that pass the CharSequence directly to headers().set() without converting to String?

Also regarding the tests, I've updated them to handle the ambiguous method calls by adding CharSequence cast - is this the right approach?

@tsegismont
Copy link
Member

@tsegismont thanks for review

Just to make sure I understand correctly before I push the changes - you want me to keep the default implementations in the HttpRequest interface, but also keep efficient override implementations in HttpRequestImpl that pass the CharSequence directly to headers().set() without converting to String?

Exactly

Also regarding the tests, I've updated them to handle the ambiguous method calls by adding CharSequence cast - is this the right approach?

Yes

@VynbzVynbzforce-pushed thefeat/charsequence-header-names branch from1373084 to2eda11eCompareSeptember 15, 2025 14:15
@Vynbz
Copy link
Author

@tsegismont Done! Changes implemented as discussed and commits squashed

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tsegismonttsegismonttsegismont left review comments

Assignees

No one assigned

Labels

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

3 participants

@Vynbz@tsegismont@vietj

[8]ページ先頭

©2009-2025 Movatter.jp