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

fix(analytics): update error handling #3261

Merged
merged 1 commit into from
Oct 2, 2023
Merged

Conversation

atierian
Copy link
Member

@atierian atierian commented Oct 2, 2023

Swift SDK Update 0.26.0

Makes necessary changes to get AWSPluginsCore to compile.

Debt Introduced

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


class AnalyticsErrorHelper {
enum AnalyticsErrorHelper {
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why this was changed from class to enum?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I must've instinctively made that change without realizing it.
As a simple namespace, it should be an enum. That said, I don't mind reverting as it doesn't really belong in this PR.

@atierian atierian merged commit a20f195 into swift-sdk-0260 Oct 2, 2023
35 of 61 checks passed
@atierian atierian deleted the sdk/analytics branch October 2, 2023 20:16
request.headers = headers
for header in headers.headers {
for value in header.value {
request.withHeader(name: header.name, value: value)
Copy link
Member

Choose a reason for hiding this comment

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

Looking at how this is implemented, it looks like we'll be adding all the original headers to the new additionalHeaders list, which will then be combined with the original headers resulting in unnecessary duplication.

I believe we can just do this instead:

request.withHeader(
    name: userAgentHeader, 
    value: "\(currentUserAgent)\(userAgentSuffix)"
)

But now I wonder, would we be sending two values for the User-Agent header then? 🤔. Would that still work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching that!
I've partially addressed it here #3264 and noted the potential double user-agent as an open item in the base PR #3248

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