AwsInterceptor
AwsInterceptor copied to clipboard
Interceptor adds a Slash "/" after the endpoint
Url: https://www.aws.com/api
Once the request is signed using the interceptor -
Excepted: https://www.aws.com/api
Current: https://www.aws.com/api/
Solution:
private fun Request.sign(): Request {
val canonicalUrl = url.canonicalized()
val awsDummyRequest = DefaultRequest<Any>(serviceName).apply {
****endpoint = url.host
resourcePath = url.resource**** //separate out the host and resource
httpMethod = HttpMethodName.valueOf(method)
setQueryParams(canonicalUrl)
setBody(body)
}
signer.sign(awsDummyRequest, credentialsProvider.credentials)
return newBuilder()
.url(canonicalUrl)
.applyAwsHeaders(awsDummyRequest.headers)
.build()}