> > >
package httputil
import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
)
func performRequest(r http.Handler, method, path string, body interface{}) *httptest.ResponseRecorder {
:= new(bytes.Buffer)
buf .NewEncoder(buf).Encode(body)
json:= httptest.NewRequest(method, path, buf)
req := httptest.NewRecorder()
w .ServeHTTP(w, req)
rreturn w
}