mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 19:57:40 +08:00
improve client dump for package ghttp
This commit is contained in:
parent
68cc85f2b2
commit
638773b216
@ -18,7 +18,7 @@ import (
|
||||
|
||||
// dumpTextFormat is the format of the dumped raw string
|
||||
const dumpTextFormat = `+---------------------------------------------+
|
||||
| %s |
|
||||
| %s |
|
||||
+---------------------------------------------+
|
||||
%s
|
||||
%s
|
||||
@ -50,7 +50,7 @@ func (r *ClientResponse) RawRequest() string {
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
dumpTextFormat,
|
||||
"REQUEST",
|
||||
"REQUEST ",
|
||||
gconv.UnsafeBytesToStr(bs),
|
||||
r.requestBody,
|
||||
)
|
||||
|
@ -42,6 +42,7 @@ func Test_Client_Request_13_Dump(t *testing.T) {
|
||||
dumpedText := r.RawRequest()
|
||||
t.Assert(gstr.Contains(dumpedText, "test_for_request_body"), true)
|
||||
dumpedText2 := r.RawResponse()
|
||||
fmt.Println(dumpedText2)
|
||||
t.Assert(gstr.Contains(dumpedText2, "test_for_response_body"), true)
|
||||
|
||||
client2 := ghttp.NewClient().SetPrefix(url).ContentType("text/html")
|
||||
|
Loading…
Reference in New Issue
Block a user