新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)GoFrame教程:GoFrameHTTPClient-請求信息打印
基本介紹
?http?客戶端支持對?HTTP?請求的輸入與輸出原始信息獲取與打印,方便調(diào)試,相關(guān)方法如下:

成都創(chuàng)新互聯(lián)公司專注于南湖網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供南湖營銷型網(wǎng)站建設(shè),南湖網(wǎng)站制作、南湖網(wǎng)頁設(shè)計、南湖網(wǎng)站官網(wǎng)定制、成都小程序開發(fā)服務(wù),打造南湖網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供南湖網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
func (r *Response) Raw() string
func (r *Response) RawDump()
func (r *Response) RawRequest() string
func (r *Response) RawResponse() string可以看到,所有的方法均綁定在?Response?對象上,也就是說必須要請求結(jié)束后才能打印。
使用示例
package main
import (
"github.com/GOgf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
)
func main() {
response, err := g.Client().Post(
gctx.New(),
"https://GoFrame.org",
g.Map{
"name": "john",
},
)
if err != nil {
panic(err)
}
response.RawDump()
}執(zhí)行后,終端輸出為:
+---------------------------------------------+
| REQUEST |
+---------------------------------------------+
POST / HTTP/1.1
Host: goframe.org
User-Agent: GoFrameHTTPClient v2.0.0-beta
Content-Length: 9
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
name=john
+---------------------------------------------+
| RESPONSE |
+---------------------------------------------+
HTTP/1.1 405 Method Not Allowed
Connection: close
Transfer-Encoding: chunked
Allow: GET
Cache-Control: no-store
Content-Security-Policy: frame-ancestors 'self'
Content-Type: text/html;charset=UTF-8
Date: Fri, 03 Dec 2021 09:43:29 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: nginx
... 網(wǎng)頁名稱:創(chuàng)新互聯(lián)GoFrame教程:GoFrameHTTPClient-請求信息打印
URL分享:http://fisionsoft.com.cn/article/ccoghsj.html


咨詢
建站咨詢
