improve client dump for package ghttp

This commit is contained in:
John 2020-11-12 18:57:18 +08:00
parent 68cc85f2b2
commit 638773b216
2 changed files with 3 additions and 2 deletions

View File

@ -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,
)

View File

@ -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")