You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like there's a conceptual problem with needing to provide the complete URL path as part of the URLRequest for the sign method. I ran across this implementing the AWS SNS Publish method. A URL parameter required there is in JSON format. It seems that in order for the URLRequest(url: url) to work, I have to URL encode the URL for the JSON. However, within SwiftAWSSignatureV4 there is a second URL encode step, which then later causes the signature re-generation on the AWS side to fail. Thus, it seems necessary to pass the URL or the query args at least separately into the sign method in this case. Not a huge change to the code, but a definite conceptual issue. I'm going add this to my existing PR.
The text was updated successfully, but these errors were encountered:
Actually, upon deeper looking into this, I think this is a bigger problem. I had thought I could modify the url of the URLRequest inside of the signing method to deal with passing in a URL query arg separately. However, this doesn't seem possible. URLRequest is a struct and self.url is cannot be changed inside of the extension. I see two ways of dealing with this:
Return the URL encoded query arg from the signing method and require the caller to update the URLRequest with this returned value.
Change the way the signing works. Don't have it operate on a URLRequest. This could either be an alternative interface in this library, or a replacement for the existing sign method. In some ways this approach seems preferable to the current approach, given that not all users of such a class will actually use a URLRequest. E.g., I'm using the Kitura HTTP client.
It seems like there's a conceptual problem with needing to provide the complete URL path as part of the URLRequest for the
sign
method. I ran across this implementing the AWS SNS Publish method. A URL parameter required there is in JSON format. It seems that in order for theURLRequest(url: url)
to work, I have to URL encode the URL for the JSON. However, within SwiftAWSSignatureV4 there is a second URL encode step, which then later causes the signature re-generation on the AWS side to fail. Thus, it seems necessary to pass the URL or the query args at least separately into thesign
method in this case. Not a huge change to the code, but a definite conceptual issue. I'm going add this to my existing PR.The text was updated successfully, but these errors were encountered: