Skip to content

Commit

Permalink
Merge pull request #278 from benmoss/master
Browse files Browse the repository at this point in the history
Use httputil.DumpRequest to pretty-print unhandled requests
  • Loading branch information
williammartin committed Apr 17, 2018
2 parents 649b44d + a4ff0fc commit b7d1a52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ghttp/test_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"net/http/httputil"
"reflect"
"regexp"
"strings"
Expand Down Expand Up @@ -265,7 +266,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
req.Body.Close()
w.WriteHeader(s.GetUnhandledRequestStatusCode())
} else {
Expect(req).Should(BeNil(), "Received Unhandled Request")
formatted, err := httputil.DumpRequest(req, true)
Expect(err).NotTo(HaveOccurred(), "Encountered error while dumping HTTP request")
Expect(string(formatted)).Should(BeNil(), "Received Unhandled Request")
}
}
}
Expand Down

0 comments on commit b7d1a52

Please sign in to comment.