Skip to content

Commit

Permalink
Add Content-Type application/json to requests
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Grohbiel <[email protected]>
  • Loading branch information
alex-slynko authored and Aditya Anchuri committed Nov 1, 2016
1 parent edb9543 commit c51532c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/request_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (rs RequestService) Invoke(input RequestServiceInvokeInput) (RequestService
return RequestServiceInvokeOutput{}, fmt.Errorf("failed constructing request: %s", err)
}

request.Header.Set("Content-Type", "application/json")
response, err := rs.client.Do(request)
if err != nil {
return RequestServiceInvokeOutput{}, fmt.Errorf("failed submitting request: %s", err)
Expand Down
3 changes: 3 additions & 0 deletions api/request_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var _ = Describe("RequestService", func() {
request := client.DoArgsForCall(0)
Expect(request.Method).To(Equal("PUT"))
Expect(request.URL.Path).To(Equal("/api/v0/api/endpoint"))
Expect(request.Header).To(Equal(http.Header{
"Content-Type": []string{"application/json"},
}))

body, err := ioutil.ReadAll(request.Body)
Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit c51532c

Please sign in to comment.