use of software.amazon.awssdk.http.SdkHttpFullRequest in project aws-sdk-java-v2 by aws.
the class BaseSigningScopeTest method presigning_withSigningRegionAndRegionScope_usesRegionScope.
@Test
public void presigning_withSigningRegionAndRegionScope_usesRegionScope() {
SigningTestCase testCase = SignerTestUtils.createBasicHeaderSigningTestCase();
SdkHttpFullRequest signedRequest = presignRequestWithScope(testCase, null, RegionScope.GLOBAL);
assertThat(signedRequest.rawQueryParameters().get("X-Amz-Region-Set")).containsExactly(RegionScope.GLOBAL.id());
}
use of software.amazon.awssdk.http.SdkHttpFullRequest in project aws-sdk-java-v2 by aws.
the class BaseSigningScopeTest method presigning_withDefaultScopeAndExplicitScope_usesExplicitScope.
@Test
public void presigning_withDefaultScopeAndExplicitScope_usesExplicitScope() {
SigningTestCase testCase = SignerTestUtils.createBasicHeaderSigningTestCase();
String expectdScope = "us-west-2";
SdkHttpFullRequest signedRequest = presignRequestWithScope(testCase, RegionScope.GLOBAL, RegionScope.create(expectdScope));
assertThat(signedRequest.rawQueryParameters().get("X-Amz-Region-Set")).containsExactly(expectdScope);
}
use of software.amazon.awssdk.http.SdkHttpFullRequest in project aws-sdk-java-v2 by aws.
the class CrtHttpRequestConverterTest method request_withQueryParams_isConvertedToCrtFormat.
@Test
public void request_withQueryParams_isConvertedToCrtFormat() {
SdkHttpFullRequest request = SdkHttpFullRequest.builder().method(SdkHttpMethod.GET).putRawQueryParameter("param1", "value1").putRawQueryParameter("param2", Arrays.asList("value2-1", "value2-2")).putHeader("Host", "demo.us-east-1.amazonaws.com").encodedPath("/path").uri(URI.create("https://demo.us-east-1.amazonaws.com")).build();
HttpRequest crtHttpRequest = converter.requestToCrt(request);
assertThat(crtHttpRequest.getMethod()).isEqualTo("GET");
assertThat(crtHttpRequest.getEncodedPath()).isEqualTo("/path?param1=value1¶m2=value2-1¶m2=value2-2");
assertHttpRequestSame(request, crtHttpRequest);
}
use of software.amazon.awssdk.http.SdkHttpFullRequest in project aws-sdk-java-v2 by aws.
the class CrtHttpRequestConverterTest method assertHttpRequestSame.
private void assertHttpRequestSame(SdkHttpFullRequest originalRequest, HttpRequest crtRequest) {
SdkHttpFullRequest sdkRequest = converter.crtRequestToHttp(originalRequest, crtRequest);
assertThat(sdkRequest.method()).isEqualTo(originalRequest.method());
assertThat(sdkRequest.protocol()).isEqualTo(originalRequest.protocol());
assertThat(sdkRequest.host()).isEqualTo(originalRequest.host());
assertThat(sdkRequest.encodedPath()).isEqualTo(originalRequest.encodedPath());
assertThat(sdkRequest.headers()).isEqualTo(originalRequest.headers());
assertThat(sdkRequest.rawQueryParameters()).isEqualTo(originalRequest.rawQueryParameters());
}
use of software.amazon.awssdk.http.SdkHttpFullRequest in project aws-sdk-java-v2 by aws.
the class CrtHttpRequestConverterTest method request_withEmptyPath_isConvertedToCrtFormat.
@Test
public void request_withEmptyPath_isConvertedToCrtFormat() {
SdkHttpFullRequest request = SdkHttpFullRequest.builder().method(SdkHttpMethod.GET).putHeader("Host", "demo.us-east-1.amazonaws.com").encodedPath("").uri(URI.create("https://demo.us-east-1.amazonaws.com")).build();
HttpRequest crtHttpRequest = converter.requestToCrt(request);
assertThat(crtHttpRequest.getEncodedPath()).isEqualTo("/");
assertHttpRequestSame(request, crtHttpRequest);
}
Aggregations