resp := &http.Response{
StatusCode: 200,
ProtoMajor: 1,
ProtoMinor: 1,
Header: http.Header{"Content-Type": []string{"text/plain"}},
Body: ioutil.NopCloser(strings.NewReader("Hello, World!")),
}
go http.Response返回json数据
最新推荐文章于 2024-06-07 19:32:59 发布
本文介绍了如何处理HTTP响应,包括200状态码、Content-Type为text/plain的内容以及使用ioutil.NopCloser读取包含Hello,World!的正文。
1549

被折叠的 条评论
为什么被折叠?



