Skip to content

Commit 14da40f

Browse files
Hugo Osvaldo Barrerabmoffatt
Hugo Osvaldo Barrera
andauthored
Add omitempty to ALBTargetGroupRequest.Body (#408)
If a lambda returns `Body: nil`, then the ALB returns a 502. Co-authored-by: Bryan Moffatt <[email protected]>
1 parent c481c61 commit 14da40f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

events/alb.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type ALBTargetGroupRequest struct {
1010
MultiValueHeaders map[string][]string `json:"multiValueHeaders,omitempty"`
1111
RequestContext ALBTargetGroupRequestContext `json:"requestContext"`
1212
IsBase64Encoded bool `json:"isBase64Encoded"`
13-
Body string `json:"body"`
13+
Body string `json:"body,omitempty"`
1414
}
1515

1616
// ALBTargetGroupRequestContext contains the information to identify the load balancer invoking the lambda

events/testdata/alb-lambda-target-request-headers-only.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@
2121
"x-imforwards": "20",
2222
"x-myheader": "123"
2323
},
24-
"body": "",
2524
"isBase64Encoded": false
26-
}
25+
}

events/testdata/alb-lambda-target-request-multivalue-headers.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
"123"
4444
]
4545
},
46-
"body": "",
46+
"body": "Some text",
4747
"isBase64Encoded": false
48-
}
48+
}

0 commit comments

Comments
 (0)