标签:status ring body touch return client turn decode esc
type CityWeather struct {
Data WatherDetail
Status int
Desc string
}
type WatherDetail struct {
Ysterday string
City string
Forecast []map[string]string
Ganmao string
Wendu string
}
func TestHttp3(t *testing.T){
queryWeatherURL := "http://wthrcdn.etouch.cn/weather_mini?city=杭州"
httpclient := &http.Client{}
resp, err := httpclient.Get(queryWeatherURL)
if err!=nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
cityWeather := new(CityWeather)
_ = json.NewDecoder(resp.Body).Decode(cityWeather)
fmt.Println(cityWeather.Data.City)
}
标签:status ring body touch return client turn decode esc
原文地址:https://www.cnblogs.com/jzsg/p/10923514.html