httpassert:用于golang的http响应主体断言工具
HTTP ASSERT
用于golang的HTTP响应主体断言工具。
安装
go get github.com/zgs225/httpassert
例子
func TestSomeHTTPEndpoint ( t * testing. T ) {
req := httptest . NewRequest ( "GET" , "http://localhost/users?page=2" , nil )
res := httptest . NewRecord ()
someHttpServer . ServeHTTP ( res , req )
expected := Response {
Total : 10 ,
Current : 2 ,
Items : [] User {
{
Name : "John" ,