Skip to content

Commit

Permalink
Provide default fragment(String) override for all request types (#2626
Browse files Browse the repository at this point in the history
)

Motivation:

Even though `HttpRequestMetaData#fragment()` has default implementation,
because all request types override it with different return type, we
must provide default implementations for these overrides too. Otherwise,
the code is not backward compatible.

Modifications:

- Add `default` implementation for `fragment(String)` in
`HttpRequest`, `StreamingHttpRequest`, `BlockingStreamingHttpRequest`;

Result:

Request interfaces are backward compatible.
  • Loading branch information
idelpivnitskiy authored Jun 23, 2023
1 parent fbd61ef commit 7d9eeb7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ default <T> BlockingStreamingHttpRequest transform(TrailersTransformer<T, Buffer
BlockingStreamingHttpRequest version(HttpProtocolVersion version);

@Override
BlockingStreamingHttpRequest fragment(@Nullable String fragment);
default BlockingStreamingHttpRequest fragment(@Nullable String fragment) {
throw new UnsupportedOperationException("BlockingStreamingHttpRequest#fragment(String) is not supported by " +
getClass());
}

@Deprecated
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ default <T> HttpRequest payloadBody(T pojo, HttpSerializer<T> serializer) {
HttpRequest setQueryParameters(String key, String... values);

@Override
HttpRequest fragment(@Nullable String fragment);
default HttpRequest fragment(@Nullable String fragment) {
throw new UnsupportedOperationException("HttpRequest#fragment(String) is not supported by " +
getClass());
}

@Override
HttpRequest version(HttpProtocolVersion version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ <T, S> StreamingHttpRequest transform(TrailersTransformer<T, S> trailersTransfor
StreamingHttpRequest method(HttpRequestMethod method);

@Override
StreamingHttpRequest fragment(@Nullable String fragment);
default StreamingHttpRequest fragment(@Nullable String fragment) {
throw new UnsupportedOperationException("StreamingHttpRequest#fragment(String) is not supported by " +
getClass());
}

@Deprecated
@Override
Expand Down

0 comments on commit 7d9eeb7

Please sign in to comment.