-
Notifications
You must be signed in to change notification settings - Fork 421
feat(event_handler): add cookies as 1st class citizen in v2 #1487
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
Conversation
97bd70f
to
e93ae12
Compare
e93ae12
to
a551fd5
Compare
@heitorlessa @leandrodamascena would appreciate early feedback on this one before I continue to apply changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super clean, I loved it. Some suggestions and two questions on why not enabling httpOnly
and Secure
attrs by default (there's probably good reasons that I prolly don't know)
…ws-powertools#1455) Co-authored-by: Heitor Lessa <[email protected]>
ff96266
to
fe4ea7d
Compare
assert "MonsterCookie" in response.cookies.keys() | ||
assert "CookieMonster" in response.cookies.keys() | ||
# ALB sorts the header values randomly, so we have to re-order them for comparison here | ||
returned_value = ", ".join(sorted(response.headers[key].split(", "))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for us: maybe we should have an utility function for this as we'll forget at some point (syntax et al)
Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Heitor Lessa <[email protected]>
* develop: chore(deps-dev): bump aws-cdk-lib from 2.40.0 to 2.41.0 (#1507) update changelog with latest changes feat(tracer): support methods with the same name (ABCs) by including fully qualified name in v2 (#1486) chore(deps-dev): bump aws-cdk-aws-apigatewayv2-integrations-alpha from 2.39.1a0 to 2.40.0a0 (#1496) chore(deps-dev): bump mkdocs-material from 8.4.2 to 8.4.3 (#1504) chore(deps): bump pydantic from 1.10.1 to 1.10.2 (#1502) update changelog with latest changes feat(data-classes): add KafkaEvent and KafkaEventRecord (#1485) chore(deps-dev): bump pytest from 7.1.2 to 7.1.3 (#1497) update changelog with latest changes feat(event_handler): add cookies as 1st class citizen in v2 (#1487) chore(deps-dev): bump black from 22.6.0 to 22.8.0 (#1494) chore(deps-dev): bump aws-cdk-lib from 2.39.1 to 2.40.0 (#1495) chore(maintenance): add discord link to first PR and first issue (#1493) update changelog with latest changes refactor(batch): remove legacy sqs_batch_processor (#1492) chore(deps): bump pydantic from 1.10.0 to 1.10.1 (#1491) chore(deps-dev): bump flake8-variables-names from 0.0.4 to 0.0.5 (#1490)
…rtools#1487) Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Heitor Lessa <[email protected]>
…rtools#1487) Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Heitor Lessa <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Heitor Lessa <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Heitor Lessa <[email protected]>
Issue number: #1192
Summary
This PR adds first class support for Cookies. After the last PR where we added multiple header values and cookies, we noticed we could improve the experience of Cookies by having a strongly typed class based approach.
Changes
I've added a class for
Cookie
modeling the most common options that are used today according to the RFC.It also updated and extends the E2E tests to be more comprehensive and generic.
User experience
Before, the user would have to encode the cookie himself, producing a string with the desired output:
This would be error prone, as getting the string right can be the source of bugs.
With the new class based Cookie, this becomes simpler:
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.