Go语言:获取http状态码
2019-05-08 本文已影响3144人
白祤星
代码实例
package main
import (
"net/http"
)
func main() {
res, _ := http.Get(`https://www.jianshu.com/p/dcfee5d30420`)
defer res.Body.Close()
println(res.StatusCode)
}
package main
import (
"net/http"
)
func main() {
res, _ := http.Get(`https://www.jianshu.com/p/dcfee5d30420`)
defer res.Body.Close()
println(res.StatusCode)
}