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 Cookie#setAttribute, v2 #400

Closed
wants to merge 8 commits into from
Closed

Add Cookie#setAttribute, v2 #400

wants to merge 8 commits into from

Conversation

BalusC
Copy link
Member

@BalusC BalusC commented May 2, 2021

As requested by @gregw here #399 (comment)

@BalusC BalusC mentioned this pull request May 2, 2021
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I like the semantics of this one more.... but slightly concerned with the efficiency of having to always create the map... basically on every request with a cookie.

This would be OK, so long as an implementation could override methods with a more efficient implementation for cookies that it knows have no special attributes. But this version will not let the underlying attributes map not be created.

In reality, it was a mistake that this was not an interface, with readonly and read/write versions... ie there is no need to call a setter on a Cookie obtained from a request.

As this can effect trillions of requests, every nano second we can save here will save many Kgs of carbon. So give me a day or two and I'll see if I can come up with a version that keeps the API, but can be more efficient for the most frequent cases.

@gregw
Copy link
Contributor

gregw commented May 3, 2021

I've created #401 that lazily creates the attribute map, so it will not be instantiated on the most frequent usage of an inbound cookie

@gregw
Copy link
Contributor

gregw commented May 3, 2021

@markt-asf @stuartwdouglas should we be creating unit tests for any API that we update/change? If so... is there a test framework we should use?

@stuartwdouglas
Copy link
Contributor

I think unit tests are a good idea. My preference would be JUnit 5.

@BalusC
Copy link
Member Author

BalusC commented May 4, 2021

Closing off. This is superseded by #401

@BalusC BalusC closed this May 4, 2021
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