The documentation/examples of the net/http/httptest package might help, in particular, the ResponseRecorder.
https://golang.org/pkg/net/http/httptest/#ResponseRecorder On Mon, Apr 1, 2019 at 10:51 AM <aniruddha.dwiv...@nytimes.com> wrote: > > Hi, > > I am writing test cases in golang for one of service used in my organisation. > In one of file, I have below method -- > > > func encodeEdgeResp(_ context.Context, w http.ResponseWriter, response > interface{}) error { > w.Header().Set("Content-Type", "application/json; charset=utf-8") > return json.NewEncoder(w).Encode(response) > } > > > I am unable to understand how can I pass/mock http.ResponseWriter over here > to run my test cases. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.