-
Notifications
You must be signed in to change notification settings - Fork 264
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
Remove guava dependency #88
Conversation
Fixes #59 |
Ah! Ok... |
@@ -70,7 +68,7 @@ | |||
} | |||
} | |||
|
|||
@VisibleForTesting | |||
//@VisibleForTesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just drop it
Almost scary how similar our code is 👻 |
👍 |
|
||
Headers() { | ||
public HeadersBuilder() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be its own class now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking of implementing Header
and Headers implements Iterable<Header>
classes instead of map of lists as this will allow to extend it in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we need a map for easy lookups, e.g. in conditions.
@@ -70,18 +71,18 @@ | |||
|
|||
public static Predicate<RawHttpRequest> header(final String key, final String value) { | |||
return request -> | |||
request.getHeaders().containsEntry(key, value); | |||
request.getHeaders().getOrDefault(key, Collections.emptyList()).contains(value); | |||
} | |||
|
|||
public static Predicate<RawHttpRequest> header(final String key, final Predicate<String> predicate) { | |||
return request -> | |||
request.getHeaders().get(key).stream().anyMatch(predicate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will throw an exception now if a key doesn't exist. Can you verify with a test?
👍 |
👍 nice collective effort |
👍 |
Looks like now everybody will do this)