equal
deleted
inserted
replaced
316 /** |
316 /** |
317 * Returns a response body handler which discards the response body and |
317 * Returns a response body handler which discards the response body and |
318 * uses the given value as a replacement for it. |
318 * uses the given value as a replacement for it. |
319 * |
319 * |
320 * @param <U> the response body type |
320 * @param <U> the response body type |
321 * @param value the value of U to return as the body, may be null |
321 * @param value the value of U to return as the body, may be {@code null} |
322 * @return a response body handler |
322 * @return a response body handler |
323 */ |
323 */ |
324 public static <U> BodyHandler<U> discard(U value) { |
324 public static <U> BodyHandler<U> discard(U value) { |
325 return (status, headers) -> BodySubscriber.discard(value); |
325 return (status, headers) -> BodySubscriber.discard(value); |
326 } |
326 } |
703 * Returns a response subscriber which discards the response body. The |
703 * Returns a response subscriber which discards the response body. The |
704 * supplied value is the value that will be returned from |
704 * supplied value is the value that will be returned from |
705 * {@link HttpResponse#body()}. |
705 * {@link HttpResponse#body()}. |
706 * |
706 * |
707 * @param <U> The type of the response body |
707 * @param <U> The type of the response body |
708 * @param value the value to return from HttpResponse.body(), may be null |
708 * @param value the value to return from HttpResponse.body(), may be {@code null} |
709 * @return a {@code BodySubscriber} |
709 * @return a {@code BodySubscriber} |
710 */ |
710 */ |
711 public static <U> BodySubscriber<U> discard(U value) { |
711 public static <U> BodySubscriber<U> discard(U value) { |
712 return new ResponseSubscribers.NullSubscriber<>(Optional.ofNullable(value)); |
712 return new ResponseSubscribers.NullSubscriber<>(Optional.ofNullable(value)); |
713 } |
713 } |