Merge pull request #4617 from wmk52755/func_name_0518

Func name 0518
This commit is contained in:
Ming Deng 2021-05-19 12:58:49 +08:00 committed by GitHub
commit 869b0b6f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -351,7 +351,7 @@ func TestNewBeegoRequest(t *testing.T) {
assert.NotNil(t, req) assert.NotNil(t, req)
} }
func TestBeegoHTTPRequest_SetProtocolVersion(t *testing.T) { func TestBeegoHTTPRequestSetProtocolVersion(t *testing.T) {
req := NewBeegoRequest("http://beego.me", "GET") req := NewBeegoRequest("http://beego.me", "GET")
req.SetProtocolVersion("HTTP/3.10") req.SetProtocolVersion("HTTP/3.10")
assert.Equal(t, "HTTP/3.10", req.req.Proto) assert.Equal(t, "HTTP/3.10", req.req.Proto)
@ -376,21 +376,21 @@ func TestPut(t *testing.T) {
assert.Equal(t, "PUT", req.req.Method) assert.Equal(t, "PUT", req.req.Method)
} }
func TestBeegoHTTPRequest_Header(t *testing.T) { func TestBeegoHTTPRequestHeader(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
key, value := "test-header", "test-header-value" key, value := "test-header", "test-header-value"
req.Header(key, value) req.Header(key, value)
assert.Equal(t, value, req.req.Header.Get(key)) assert.Equal(t, value, req.req.Header.Get(key))
} }
func TestBeegoHTTPRequest_SetHost(t *testing.T) { func TestBeegoHTTPRequestSetHost(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
host := "test-hose" host := "test-hose"
req.SetHost(host) req.SetHost(host)
assert.Equal(t, host, req.req.Host) assert.Equal(t, host, req.req.Host)
} }
func TestBeegoHTTPRequest_Param(t *testing.T) { func TestBeegoHTTPRequestParam(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
key, value := "test-param", "test-param-value" key, value := "test-param", "test-param-value"
req.Param(key, value) req.Param(key, value)
@ -401,7 +401,7 @@ func TestBeegoHTTPRequest_Param(t *testing.T) {
assert.Equal(t, value1, req.params[key][1]) assert.Equal(t, value1, req.params[key][1])
} }
func TestBeegoHTTPRequest_Body(t *testing.T) { func TestBeegoHTTPRequestBody(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
body := `hello, world` body := `hello, world`
req.Body([]byte(body)) req.Body([]byte(body))
@ -409,7 +409,7 @@ func TestBeegoHTTPRequest_Body(t *testing.T) {
assert.NotNil(t, req.req.GetBody) assert.NotNil(t, req.req.GetBody)
assert.NotNil(t, req.req.Body) assert.NotNil(t, req.req.Body)
body = "hhhh, i am test" body = "hhhh, I am test"
req.Body(body) req.Body(body)
assert.Equal(t, int64(len(body)), req.req.ContentLength) assert.Equal(t, int64(len(body)), req.req.ContentLength)
assert.NotNil(t, req.req.GetBody) assert.NotNil(t, req.req.GetBody)
@ -423,7 +423,7 @@ type user struct {
Name string `xml:"name"` Name string `xml:"name"`
} }
func TestBeegoHTTPRequest_XMLBody(t *testing.T) { func TestBeegoHTTPRequestXMLBody(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
body := &user{ body := &user{
Name: "Tom", Name: "Tom",