Expose HttpRequest from ClientResponse
Closes gh-28397
This commit is contained in:
@@ -72,6 +72,12 @@ public interface ClientResponse {
|
||||
*/
|
||||
ExchangeStrategies strategies();
|
||||
|
||||
/**
|
||||
* Return the request associated with the response.
|
||||
* @since 6.1
|
||||
*/
|
||||
HttpRequest request();
|
||||
|
||||
/**
|
||||
* Extract the body with the given {@code BodyExtractor}.
|
||||
* @param extractor the {@code BodyExtractor} that reads from the response
|
||||
|
||||
@@ -262,8 +262,8 @@ class DefaultClientResponse implements ClientResponse {
|
||||
return this.logPrefix;
|
||||
}
|
||||
|
||||
// Used by DefaultClientResponseBuilder
|
||||
HttpRequest request() {
|
||||
@Override
|
||||
public HttpRequest request() {
|
||||
return this.requestSupplier.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseCookie;
|
||||
@@ -68,11 +69,6 @@ public class ClientResponseWrapper implements ClientResponse {
|
||||
return this.delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExchangeStrategies strategies() {
|
||||
return this.delegate.strategies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpStatusCode statusCode() {
|
||||
return this.delegate.statusCode();
|
||||
@@ -88,6 +84,16 @@ public class ClientResponseWrapper implements ClientResponse {
|
||||
return this.delegate.cookies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExchangeStrategies strategies() {
|
||||
return this.delegate.strategies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest request() {
|
||||
return this.delegate.request();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T body(BodyExtractor<T, ? super ClientHttpResponse> extractor) {
|
||||
return this.delegate.body(extractor);
|
||||
|
||||
Reference in New Issue
Block a user