INNER CODE UNIT · Go
testBase64BodyResponseNoMatch
akrylysov/algnhsa · apigw_v1_test.go:266
func testBase64BodyResponseNoMatch(t *testing.T, event string) {
asrt := assert.New(t)
handler := func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello from Lambda!")
}
lh := lambdaHandler{
httpHandler: http.HandlerFunc(handler),
opts: &Options{BinaryContentTypes: []string{"image/png"}},
}
lh.opts.init()
responseBytes, err := lh.Invoke(context.Background(), []byte(event))
asrt.NoError(err)
var r events.APIGatewayProxyResponse
err = json.Unmarshal(responseBytes, &r)
asrt.NoError(err)
asrt.Equal(200, r.StatusCode)