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:
Stephane Landelle 2019-01-22 08:49:43 +01:00 committed by Norman Maurer
parent cf03ed0478
commit 0431368621

View File

@ -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);
// unquoted tokens in the expect header are case-insensitive, thus 100-continue is case insensitive
return HttpHeaderValues.CONTINUE.toString().equalsIgnoreCase(expectValue);
return isExpectHeaderValid(message)
// unquoted tokens in the expect header are case-insensitive, thus 100-continue is case insensitive
&& message.headers().contains(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE, true);
}
/**