-
Notifications
You must be signed in to change notification settings - Fork 557
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 API Gateway V2 custom authorizer simple response type #386
Add API Gateway V2 custom authorizer simple response type #386
Conversation
events/apigw.go
Outdated
// APIGatewayV2CustomAuthorizerSimpleResponse represents the simple format of an API Gateway V2 authorization response. | ||
type APIGatewayV2CustomAuthorizerSimpleResponse struct { | ||
IsAuthorized bool `json:"isAuthorized"` | ||
Context map[string]interface{} `json:"context"` |
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.
Did you get a chance to verify this works as expected with a context set and without it set (using the default value). I just wonder what happens if Context
is nil (null
in json) and/or an empty map ({}
in json)
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.
Yes, already using it in production for a while. Works with or without context. So the API accepts the input. But I could check what’s exactly generated and if it makes sense to add omitempty
.
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.
It might make sense and save just a few bytes over the long run so if you could check that would be great
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.
Hey @harrisonhjones, I just added the tests. Pls take a look if I covered everything.
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.
BTW, I also added the omitempty
flag, as the results are more reasonable.
291457d
to
13d994a
Compare
13d994a
to
6630aa2
Compare
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.
LGTM.
@bmoffatt or someone else on the Lambda team would need to merge it in. |
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.
LGTM!
Issue #369, #372:
Description of changes:
This PR adds the missing type for API Gateway V2 custom authorizer simple response. See: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html#http-api-lambda-authorizer.payload-format-response
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.