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 omitempty to ALBTargetGroupRequest.Body #408

Merged
merged 3 commits into from Nov 30, 2021
Merged

Conversation

WhyNotHugo
Copy link
Contributor

If a lambda returns Body: nil, then the ALB returns a 502.

If a lambda returns `Body: nil`, then the ALB returns a 502.
@bmoffatt
Copy link
Collaborator

Verified that ALB does as you say, 502 returned with json {"statusCode": 200, "body": null} but expect 200 returned when json is {"statusCode": 200}. The go struct isn't actually able to produce this, since the type is string rather than *string.

So... I think it's OK to represent in this model that null should never be written for this integration. As far as I can tell in my testing it's also harmless to drop the empty string body, ALB behaves the same way.

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2021

Codecov Report

Merging #408 (e11f266) into main (ce10e61) will not change coverage.
The diff coverage is n/a.

❗ Current head e11f266 differs from pull request most recent head 9418691. Consider uploading reports for the commit 9418691 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #408   +/-   ##
=======================================
  Coverage   71.63%   71.63%           
=======================================
  Files          19       19           
  Lines        1040     1040           
=======================================
  Hits          745      745           
  Misses        228      228           
  Partials       67       67           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c481c61...9418691. Read the comment docs.

@bmoffatt bmoffatt merged commit 14da40f into aws:main Nov 30, 2021
@WhyNotHugo WhyNotHugo deleted the patch-1 branch November 30, 2021 15:26
@bmoffatt
Copy link
Collaborator

bmoffatt commented Apr 7, 2022

Verified that ALB does as you say, 502 returned with json {"statusCode": 200, "body": null} but expect 200 returned when json is {"statusCode": 200}. The go struct isn't actually able to produce this, since the type is string rather than *string.

So... I think it's OK to represent in this model that null should never be written for this integration. As far as I can tell in my testing it's also harmless to drop the empty string body, ALB behaves the same way.

I was referencing this issue recently in a discussion, and realized that the change modified the request, not the response - so the issue described of a 5xx on the response path still exists.

@WhyNotHugo
Copy link
Contributor Author

🤦 You're right.

bmoffatt added a commit to bmoffatt/aws-lambda-go that referenced this pull request Jul 13, 2022
bmoffatt added a commit to bmoffatt/aws-lambda-go that referenced this pull request Jul 13, 2022
bmoffatt added a commit that referenced this pull request Jul 27, 2022
…tent (#455)

* Revert "Add `omitempty` to ALBTargetGroupRequest.Body (#408)"

This reverts commit 14da40f.

* update alb response struct per #408 intent
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

3 participants