Skip to content

Commit

Permalink
Merge pull request #11 from twharmon/response-fake
Browse files Browse the repository at this point in the history
Response-fake
  • Loading branch information
twharmon authored Apr 11, 2022
2 parents c7a3610 + 575cd24 commit ef8810b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fakes/response.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fakes

import (
"encoding/json"
"net/http"

"github.com/aws/aws-lambda-go/events"
Expand All @@ -20,6 +21,12 @@ func NewResponse() *Response {
}
}

func (r *Response) WithBody(v interface{}) {
b, err := json.Marshal(v)
r.response.Body = string(b)
r.err = err
}

func (r *Response) Respond() (*events.APIGatewayV2HTTPResponse, error) {
return r.response, r.err
}
Expand Down

0 comments on commit ef8810b

Please sign in to comment.