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 CookieSameSite DSL #3401

Merged
merged 6 commits into from Oct 23, 2023
Merged

Add CookieSameSite DSL #3401

merged 6 commits into from Oct 23, 2023

Conversation

jaredLunde
Copy link
Contributor

@jaredLunde jaredLunde commented Oct 22, 2023

Adds support for the SameSite cookie attribute available in net/http since Go 1.11.

I think this covers everything, but let me know if there's anything else I can/need to do.

Copy link
Member

@raphael raphael left a comment

Choose a reason for hiding this comment

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

This looks great! The convention has been to redefine the constants in the DSL package so that the documentation is self-contained, see formats, HTTP , gRPC status codes, or data types for examples. I'll merge once these are added, thank you!

@@ -1352,6 +1352,9 @@ const responseT = `{{ define "response" -}}
{{- if .HTTPOnly }}
HttpOnly: true,
{{- end }}
{{- if .SameSite }}
SameSite: {{ printf "%q" .SameSite }},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will these generated lines print the enum from the net/http package e.g. http.SameSiteLaxMode? It just occurred to me that this could be a problem, as http.SameSite___ are iotas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually there are a couple of issues with this including the "%q" 😅 Will fix. Where can I add tests for the codegen piece?

@raphael
Copy link
Member

raphael commented Oct 23, 2023

Looks great, thank you!

@raphael raphael merged commit 88ce4e6 into goadesign:v3 Oct 23, 2023
9 checks passed
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.

None yet

2 participants