mirror of
https://github.com/soheilhy/cmux.git
synced 2024-11-10 11:41:52 +08:00
commit
d8cc6481fa
@ -19,3 +19,4 @@ before_script:
|
||||
- echo $TRAVIS_GO_VERSION
|
||||
- if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi
|
||||
- go vet .
|
||||
- go tool vet --shadow .
|
||||
|
16
cmux_test.go
16
cmux_test.go
@ -109,23 +109,21 @@ func runTestHTTPServer(errCh chan<- error, l net.Listener) {
|
||||
}
|
||||
|
||||
func runTestHTTP1Client(t *testing.T, addr net.Addr) {
|
||||
r, err := http.Get("http://" + addr.String())
|
||||
if err != nil {
|
||||
if r, err := http.Get("http://" + addr.String()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
} else {
|
||||
defer func() {
|
||||
if err := r.Body.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
b, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
if b, err := ioutil.ReadAll(r.Body); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
} else {
|
||||
if string(b) != testHTTP1Resp {
|
||||
t.Errorf("invalid response: want=%s got=%s", testHTTP1Resp, b)
|
||||
t.Fatalf("invalid response: want=%s got=%s", testHTTP1Resp, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user