gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Add GetRequest

Open kataras opened this issue 5 years ago • 0 comments

/v2

It's extremely useful to have access to the original object

Its QueryStringParameters are not stored to the request's URL ones with the default implementation (is it a Bug?) so we need access through the original lambda request. I did create an application with google forms + aws/apex + iris + netlify functions and I had to modify the source in order for that to work. This is a simple PR which makes the APIGatewayV2HTTPRequest available to the backend developer, no breaking changes as the context key was unexported.

EDIT: for some reason the Semaphoreci is failed, but the tests are running just fine:

PS C:\mygopath\src\github.com\kataras\gateway> go test -v ./...
=== RUN   TestNewRequest_path
--- PASS: TestNewRequest_path (0.00s)
=== RUN   TestNewRequest_method
--- PASS: TestNewRequest_method (0.00s)
=== RUN   TestNewRequest_queryString
--- PASS: TestNewRequest_queryString (0.00s)
=== RUN   TestNewRequest_multiValueQueryString
--- PASS: TestNewRequest_multiValueQueryString (0.00s)
=== RUN   TestNewRequest_remoteAddr
--- PASS: TestNewRequest_remoteAddr (0.00s)
=== RUN   TestNewRequest_header
--- PASS: TestNewRequest_header (0.00s)
=== RUN   TestNewRequest_multiHeader
--- PASS: TestNewRequest_multiHeader (0.00s)
=== RUN   TestNewRequest_body
--- PASS: TestNewRequest_body (0.00s)
=== RUN   TestNewRequest_bodyBinary
--- PASS: TestNewRequest_bodyBinary (0.00s)
=== RUN   TestNewRequest_context
--- PASS: TestNewRequest_context (0.00s)
=== RUN   Test_JSON_isTextMime
--- PASS: Test_JSON_isTextMime (0.00s)
=== RUN   Test_XML_isTextMime
--- PASS: Test_XML_isTextMime (0.00s)
=== RUN   TestResponseWriter_Header
--- PASS: TestResponseWriter_Header (0.00s)
=== RUN   TestResponseWriter_multiHeader
--- PASS: TestResponseWriter_multiHeader (0.00s)
=== RUN   TestResponseWriter_Write_text
=== RUN   TestResponseWriter_Write_text/text/x-custom
=== RUN   TestResponseWriter_Write_text/text/plain
=== RUN   TestResponseWriter_Write_text/text/plain;_charset=utf-8
=== RUN   TestResponseWriter_Write_text/application/json
=== RUN   TestResponseWriter_Write_text/application/json;_charset=utf-8
=== RUN   TestResponseWriter_Write_text/application/xml
=== RUN   TestResponseWriter_Write_text/image/svg+xml
--- PASS: TestResponseWriter_Write_text (0.00s)
    --- PASS: TestResponseWriter_Write_text/text/x-custom (0.00s)
    --- PASS: TestResponseWriter_Write_text/text/plain (0.00s)
    --- PASS: TestResponseWriter_Write_text/text/plain;_charset=utf-8 (0.00s)
    --- PASS: TestResponseWriter_Write_text/application/json (0.00s)
    --- PASS: TestResponseWriter_Write_text/application/json;_charset=utf-8 (0.00s)
    --- PASS: TestResponseWriter_Write_text/application/xml (0.00s)
    --- PASS: TestResponseWriter_Write_text/image/svg+xml (0.00s)
=== RUN   TestResponseWriter_Write_binary
--- PASS: TestResponseWriter_Write_binary (0.00s)
=== RUN   TestResponseWriter_Write_gzip
--- PASS: TestResponseWriter_Write_gzip (0.00s)
=== RUN   TestResponseWriter_WriteHeader
--- PASS: TestResponseWriter_WriteHeader (0.00s)
=== RUN   TestGateway_Invoke
--- PASS: TestGateway_Invoke (0.00s)
PASS
ok      github.com/apex/gateway 0.323s

/CC @wolfeidau

kataras avatar Aug 23 '20 13:08 kataras