[OLINGO-1315]ODATA V4.0 Client: API to return HTTP Request details

This commit is contained in:
Archana Rai 2018-11-19 13:44:40 +05:30
parent fb2d21d703
commit cf04fdcb4e
3 changed files with 16 additions and 0 deletions

View File

@ -41,6 +41,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
@ -439,7 +440,9 @@ public class BasicITCase extends AbstractParamTecSvcITCase {
.build();
final ODataEntityUpdateRequest<ClientEntity> request = getClient().getCUDRequestFactory().getEntityUpdateRequest(
uri, UpdateType.REPLACE, newEntity);
HttpUriRequest req = request.getHttpRequest();
final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
assertNotNull(req);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
// Check that the updated properties have changed and that other properties have their default values.

View File

@ -22,6 +22,7 @@ import java.io.InputStream;
import java.net.URI;
import java.util.Collection;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@ -39,6 +40,13 @@ public interface ODataRequest {
* @return OData request target URI.
*/
URI getURI();
/**
* Returns Http request Object.
*
* @return HttpUriRequest.
*/
HttpUriRequest getHttpRequest();
/**
* Sets OData request target URI.

View File

@ -111,6 +111,11 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
public URI getURI() {
return uri;
}
@Override
public HttpUriRequest getHttpRequest() {
return request;
}
@Override
public void setURI(final URI uri) {