1 Star 0 Fork 0

tp-go-mirrors / grequests

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
response_test.go 567 Bytes
一键复制 编辑 原始数据 按行查看 历史
Levi Gross 提交于 2015-07-01 21:31 . Added individual request proxy support
package grequests
import (
"strconv"
"testing"
)
func TestResponseOk(t *testing.T) {
status := []int{200, 201, 202, 203, 204, 205, 206, 207, 208, 226}
for _, status := range status {
verifyResponseOkForStatus(status, t)
}
}
func verifyResponseOkForStatus(status int, t *testing.T) {
url := "http://httpbin.org/status/" + strconv.Itoa(status)
resp, err := Get(url, nil)
if err != nil {
t.Error("Unable to make request", err)
}
if resp.Ok != true {
t.Errorf("Request did not return OK. Received status code %d rather a 2xx.", resp.StatusCode)
}
}
1
https://gitee.com/tp-go-mirrors/grequests.git
git@gitee.com:tp-go-mirrors/grequests.git
tp-go-mirrors
grequests
grequests
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891