Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jt0 authored Jun 9, 2020
2 parents 98a1de6 + c08fff8 commit 0f22bb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ func (r *RequestAccessor) EventToRequest(req events.APIGatewayProxyRequest) (*ht
}
}

return httpRequest, nil
httpRequest.RequestURI = httpRequest.URL.RequestURI()

return httpRequest, nil
}

func addToHeader(req *http.Request, apiGwRequest events.APIGatewayProxyRequest) (*http.Request, error) {
Expand Down
9 changes: 9 additions & 0 deletions core/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var _ = Describe("RequestAccessor tests", func() {
httpReq, err := accessor.EventToRequestWithContext(context.Background(), basicRequest)
Expect(err).To(BeNil())
Expect("/hello").To(Equal(httpReq.URL.Path))
Expect("/hello").To(Equal(httpReq.RequestURI))
Expect("GET").To(Equal(httpReq.Method))
})

Expand All @@ -33,6 +34,7 @@ var _ = Describe("RequestAccessor tests", func() {
httpReq, err := accessor.ProxyEventToHTTPRequest(basicRequest)
Expect(err).To(BeNil())
Expect("/hello").To(Equal(httpReq.URL.Path))
Expect("/hello").To(Equal(httpReq.RequestURI))
Expect("GET").To(Equal(httpReq.Method))
})

Expand All @@ -52,6 +54,7 @@ var _ = Describe("RequestAccessor tests", func() {
httpReq, err := accessor.EventToRequestWithContext(context.Background(), binaryRequest)
Expect(err).To(BeNil())
Expect("/hello").To(Equal(httpReq.URL.Path))
Expect("/hello").To(Equal(httpReq.RequestURI))
Expect("POST").To(Equal(httpReq.Method))

bodyBytes, err := ioutil.ReadAll(httpReq.Body)
Expand All @@ -74,6 +77,9 @@ var _ = Describe("RequestAccessor tests", func() {
httpReq, err := accessor.EventToRequestWithContext(context.Background(), mqsRequest)
Expect(err).To(BeNil())
Expect("/hello").To(Equal(httpReq.URL.Path))
Expect(httpReq.RequestURI).To(ContainSubstring("hello=1"))
Expect(httpReq.RequestURI).To(ContainSubstring("world=2"))
Expect(httpReq.RequestURI).To(ContainSubstring("world=3"))
Expect("GET").To(Equal(httpReq.Method))

query := httpReq.URL.Query()
Expand All @@ -98,6 +104,8 @@ var _ = Describe("RequestAccessor tests", func() {
httpReq, err := accessor.EventToRequestWithContext(context.Background(), qsRequest)
Expect(err).To(BeNil())
Expect("/hello").To(Equal(httpReq.URL.Path))
Expect(httpReq.RequestURI).To(ContainSubstring("hello=1"))
Expect(httpReq.RequestURI).To(ContainSubstring("world=2"))
Expect("GET").To(Equal(httpReq.Method))

query := httpReq.URL.Query()
Expand Down Expand Up @@ -156,6 +164,7 @@ var _ = Describe("RequestAccessor tests", func() {

Expect(err).To(BeNil())
Expect("/orders").To(Equal(httpReq.URL.Path))
Expect("/orders").To(Equal(httpReq.RequestURI))
})

contextRequest := getProxyRequest("orders", "GET")
Expand Down

0 comments on commit 0f22bb2

Please sign in to comment.