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

Breaking change in handling of headers in 1.13.0 #175

Closed
eyalroth opened this issue Dec 1, 2024 · 4 comments
Closed

Breaking change in handling of headers in 1.13.0 #175

eyalroth opened this issue Dec 1, 2024 · 4 comments

Comments

@eyalroth
Copy link

eyalroth commented Dec 1, 2024

The change in 8442685 (following #164) introduces a breaking change.

const headers = { foo: '1' };
const request = { headers };
aws4.sign(request, credentials);

// before the change, this would mutate the headers on the request, now it doesn't
headers['bar'] = '2';

This isn't necessarily a "legitimate" use case, but the change to the package may silently break existing code (especially since the change is labeled as minor).

@mhart
Copy link
Owner

mhart commented Dec 1, 2024

This has been discussed in #164 and #165 – have a read through those issues for background.

Mutating headers was never part of the public API (and never documented). What were you relying on this for?

@mhart
Copy link
Owner

mhart commented Dec 1, 2024

Closing as a duplicate of #165

@mhart mhart closed this as completed Dec 1, 2024
@eyalroth
Copy link
Author

eyalroth commented Dec 5, 2024

Mutating headers was never part of the public API (and never documented).

@mhart What public API? it's a plain JSON. No one expects a third-party function to replace the reference of properties in a JSON if it doesn't document it.

What were you relying on this for?

Tests broke due to Jest spy. It's not necessarily a production issue, but it might be.

The point is not that this change is not good, but that it should be marked as major, as it breaks existing behavior in unexpected ways.

@mhart
Copy link
Owner

mhart commented Dec 5, 2024

What public API?

The documented API in the README. All libraries have an API. The term "API" in software refers to any programming interface. The interface to a software library is one type of API.

With semver, you create a new major whenever you make breaking changes to your public API. You can read up more here: https://semver.org/

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