Skip to content

Commit

Permalink
cover RequestFromContext
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoffatt committed Apr 23, 2023
1 parent 787a3c2 commit 1650763
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lambdaurl/http_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,16 @@ func TestWrap(t *testing.T) {
})
}
}

func TestRequestContext(t *testing.T) {
var req *events.LambdaFunctionURLRequest
require.NoError(t, json.Unmarshal(helloRequest, &req))
handler := Wrap(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
reqFromContext, exists := RequestFromContext(r.Context())
require.True(t, exists)
require.NotNil(t, reqFromContext)
assert.Equal(t, req, reqFromContext)
}))
_, err := handler(context.Background(), req)
require.NoError(t, err)
}

0 comments on commit 1650763

Please sign in to comment.