Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong encoding of Swift Date as a query param #631

Closed
petrpavlik opened this issue Dec 29, 2024 · 4 comments
Closed

Wrong encoding of Swift Date as a query param #631

petrpavlik opened this issue Dec 29, 2024 · 4 comments

Comments

@petrpavlik
Copy link

Describe the bug
It looks like encoding Swift Date as query params of GET requests does not work as expected. Looks like this code

.map { (key: $0.key, value: "\($0.value)") }
uses standard description to turn a Date into a string which results in an URL looking like this:

https://email.us-east-1.amazonaws.com/v2/email/deliverability-dashboard/statistics-report/mail.indiepitcher.com?EndDate=2024-12-29%2023%3A19%3A50%20%2B0000&StartDate=2024-12-29%2023%3A19%3A50%20%2B0000

which seems to be rejected by AWS, at least for this particular endpoint. I have a repro when trying to get the sending domain statistics of SES.

To Reproduce
Steps to reproduce the behavior:

import SotoSESv2

let ses = SESv2(client: awsClient)
let statistics = try await ses.getDomainStatisticsReport(domain: "mail.indiepitcher.com", endDate: Date.now, startDate: Date.now)

Expected behavior
The request returns GetDomainStatisticsReportResponse

Actual behavior
The request fails with SerializationException: '2024-12-29 23:23:53 +0000' can not be converted to Date

Setup (please complete the following information):

  • OS: Ubuntu
  • Version of soto: 7.3.0
  • Authentication mechanism hard-coded credentials
@adam-fowler
Copy link
Member

Yeah query parameters are by-passing the encoder. Given pretty much all of them are strings and numbers, with some special cases for collections, that doesn't matter. Looks like you found an exception though.

@adam-fowler
Copy link
Member

#632 should fix this

@petrpavlik
Copy link
Author

Yes, checked the PR and looks great. Thanks!

@adam-fowler
Copy link
Member

This has been released in soto-core 7.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants