Last active
June 25, 2016 08:19
-
-
Save jrasanen/d9ae3caa71c45c2bbe927d3032a1b4ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(dlv) print request | |
*struct net/http.Request { | |
Method: "POST", | |
URL: *struct net/url.URL { | |
Scheme: "", | |
Opaque: "", | |
User: *struct net/url.Userinfo nil, | |
Host: "", | |
Path: "/counts", | |
RawPath: "", | |
RawQuery: "", | |
Fragment: "", | |
}, | |
Proto: "HTTP/1.1", | |
ProtoMajor: 1, | |
ProtoMinor: 1, | |
Header: net/http.Header [], | |
Body: io.ReadCloser(*struct io/ioutil.nopCloser) *{ | |
io.Reader: io.Reader(*struct strings.Reader) *(*struct strings.Reader)(0xc8200cc2e0), | |
}, | |
ContentLength: 12, | |
TransferEncoding: []string len: 0, cap: 0, [], | |
Close: false, | |
Host: "", | |
Form: net/url.Values [], | |
PostForm: net/url.Values [], | |
MultipartForm: *mime/multipart.Form nil, | |
Trailer: net/http.Header [], | |
RemoteAddr: "", | |
RequestURI: "", | |
TLS: *struct crypto/tls.ConnectionState nil, | |
Cancel: <-chan struct {} {}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestCountsValidPath(t *testing.T) { | |
data := url.Values{} | |
data.Set("path", "/root") | |
request, err := http.NewRequest("POST", "/counts", strings.NewReader(data.Encode())) | |
if err != nil { | |
t.Fatal(err) | |
} | |
recorder := httptest.NewRecorder() | |
handler := http.HandlerFunc(counts) | |
handler.ServeHTTP(recorder, request) | |
if status := recorder.Code; status != http.StatusOK { | |
t.Errorf("handler returned wrong status code: got %v want %v", | |
status, http.StatusOK) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment