>
> > The documentation/examples of the net/http/httptest package might 
> help, in particular, the ResponseRecorder. 
>
> https://golang.org/pkg/net/http/httptest/#ResponseRecorder 
>
>
Tacking on, here's an example: 
https://golang.org/pkg/net/http/httptest/#example_ResponseRecorder.  

The httptest package should provide what you need. Mocking HTTP 
responses is a common use case.  I will normally save responses in a 
testdata[1] directory (which is ignored by the compiler) and load from 
within my tests.

[1]: https://dave.cheney.net/2016/05/10/test-fixtures-in-go

-- 
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.

Reply via email to