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

Add support for parsing lists of strings/timestamps in headers #176

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

alextwoods
Copy link
Contributor

Description of changes:
Adds support for parsing lists of strings/timestamps in headers.

Forward port of: aws/aws-sdk-ruby@bc243c4

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@alextwoods alextwoods marked this pull request as ready for review March 18, 2024 23:06
Comment on lines 405 to 401
.split(', ')
.map { |s| Time.parse(s) }
.split(',').each_slice(2).map { |v| Time.parse(v[0] + v[1])}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header list parser should maybe handle Time case too? It should probably also call methods in TimeHelper

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, move this case to a method in the header list parser since its pretty weird logic.

And used the TimeformatHelper for the other cases.

@@ -109,13 +108,6 @@ apply InputAndOutputWithHeaders @httpRequestTests([
},
])

apply InputAndOutputWithHeaders @skipTests([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there were two tests for this one, I could be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that these protocol-test are derived from smithy protocol-tests at some point. Might be worth covering different cases that was not listed below, such as "RestJsonInputAndOutputWithTimestampHeaders"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - I think we just never ported it over. I'll add it.

parsed
end

def self.read_value(buffer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all of these be private?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - updated. Rubocop had removed the private for those (since private doesn't actually work on def self.method). Moved to class << self style.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know for myself.

@alextwoods alextwoods merged commit 702f6c5 into main Mar 19, 2024
30 checks passed
@alextwoods alextwoods deleted the header_lists branch March 19, 2024 17:58
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

Successfully merging this pull request may close these issues.

3 participants