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 for resolving accept header #290

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Fix for resolving accept header #290

merged 1 commit into from
Oct 10, 2022

Conversation

freaz
Copy link
Member

@freaz freaz commented Oct 5, 2022

Description

Do not set accept header when defined in HTTP request headers. I wanted to normalize headers and work with them, but that could lead to unexpected behavior and better will be to allow set as many headers and in any case. It will delegate need to normalize to client and server.

One thing I am not happy about, is how the logic is split in map-interpreter and filters.

Motivation and Context

Fixes #264

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have updated the documentation accordingly. If you are changing code related to user secrets you need to really make sure that security documentation is correct.
  • I have read the CONTRIBUTING document.
  • I haven't repeated the code. (DRY)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@freaz freaz force-pushed the fix/264-accept-header branch 6 times, most recently from 0802dfe to 699c3ad Compare October 6, 2022 12:13
@freaz freaz marked this pull request as ready for review October 6, 2022 12:14
Copy link
Contributor

@TheEdward162 TheEdward162 left a comment

Choose a reason for hiding this comment

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

I think the split is fine architecturally because the part in map-interpreter is responsible for collecting the information from the map (which just happens to be in a format that is the same as the header value), while the filtering is something that is specific to the HTTP client itself?

@freaz
Copy link
Member Author

freaz commented Oct 6, 2022

I don't think it is entirely wrong, but I would just like to see headers resolution in map-interpreter instead of filters.

But more importantly, when I looked at PR without focus on Accept header, I realized we work with case-sensitive keys for header names, and use of content-type and Content-Type can lead to interesting bugs.

@freaz
Copy link
Member Author

freaz commented Oct 6, 2022

I would merge this one, and apply similar approach for content-type and user-agent in headersFilter.

CHANGELOG.md Outdated Show resolved Hide resolved
@freaz freaz merged commit 37c57ec into dev Oct 10, 2022
@freaz freaz deleted the fix/264-accept-header branch October 10, 2022 08:30
@freaz freaz mentioned this pull request Oct 13, 2022
8 tasks
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.

[BUG] OneSDK overrides the custom accept header
3 participants