HttpUtil#is100ContinueExpected clean up (#8740)
Motivation: Current implementation extract header value as String. We have an idiomatic way for checking presence of a header value. Modification: Use HttpHeaders#contains for checking if if contains Expect: 100-continue. Result: Use idiomatic way + simplify boolean logic.
This commit is contained in:
parent
cf03ed0478
commit
0431368621
@ -251,13 +251,9 @@ public final class HttpUtil {
|
||||
* present
|
||||
*/
|
||||
public static boolean is100ContinueExpected(HttpMessage message) {
|
||||
if (!isExpectHeaderValid(message)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String expectValue = message.headers().get(HttpHeaderNames.EXPECT);
|
||||
return isExpectHeaderValid(message)
|
||||
// unquoted tokens in the expect header are case-insensitive, thus 100-continue is case insensitive
|
||||
return HttpHeaderValues.CONTINUE.toString().equalsIgnoreCase(expectValue);
|
||||
&& message.headers().contains(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user