Apply goimports' modifications
This commit is contained in:
@@ -51,7 +51,6 @@ Sometimes you got JSON document and you want to make it as request body. So you
|
||||
If you do this, you got this code. Instead, you should call Header to set Content-type and call Body to set body data.
|
||||
`)
|
||||
|
||||
|
||||
// start with 5 --------------------------------------------------------------------------
|
||||
|
||||
var CreateFormFileFailed = berror.DefineCode(5001001, moduleName, "CreateFormFileFailed", `
|
||||
@@ -125,7 +124,3 @@ Make sure that:
|
||||
1. You pass valid structure pointer to the function;
|
||||
2. The body is valid YAML document
|
||||
`)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
func TestNewHttpResponseWithJsonBody(t *testing.T) {
|
||||
// string
|
||||
resp := NewHttpResponseWithJsonBody("{}")
|
||||
|
||||
@@ -309,7 +309,6 @@ func TestFilterChainOrder(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
req.AddFilters(func(next Filter) Filter {
|
||||
return func(ctx context.Context, req *BeegoHTTPRequest) (*http.Response, error) {
|
||||
return NewHttpResponseWithJsonBody("second"), nil
|
||||
@@ -396,7 +395,7 @@ func TestBeegoHTTPRequest_Param(t *testing.T) {
|
||||
req.Param(key, value)
|
||||
assert.Equal(t, value, req.params[key][0])
|
||||
|
||||
value1 := "test-param-value-1"
|
||||
value1 := "test-param-value-1"
|
||||
req.Param(key, value1)
|
||||
assert.Equal(t, value1, req.params[key][1])
|
||||
}
|
||||
@@ -419,10 +418,10 @@ func TestBeegoHTTPRequest_Body(t *testing.T) {
|
||||
req.Body(13)
|
||||
}
|
||||
|
||||
|
||||
type user struct {
|
||||
Name string `xml:"name"`
|
||||
}
|
||||
|
||||
func TestBeegoHTTPRequest_XMLBody(t *testing.T) {
|
||||
req := Post("http://beego.me")
|
||||
body := &user{
|
||||
@@ -432,4 +431,4 @@ func TestBeegoHTTPRequest_XMLBody(t *testing.T) {
|
||||
assert.True(t, req.req.ContentLength > 0)
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, req.req.GetBody)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func StartMock() Stub {
|
||||
return mockFilter
|
||||
}
|
||||
|
||||
func CtxWithMock(ctx context.Context, mock... *Mock) context.Context {
|
||||
func CtxWithMock(ctx context.Context, mock ...*Mock) context.Context {
|
||||
return context.WithValue(ctx, mockCtxKey, mock)
|
||||
}
|
||||
|
||||
@@ -73,8 +73,6 @@ func NewMock(con RequestCondition, resp *http.Response, err error) *Mock {
|
||||
return &Mock{
|
||||
cond: con,
|
||||
resp: resp,
|
||||
err: err,
|
||||
err: err,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ func (sc *SimpleCondition) matchBodyFields(ctx context.Context, req *httplib.Bee
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
m := make(map[string]interface{})
|
||||
|
||||
err = json.Unmarshal(bytes, &m)
|
||||
|
||||
@@ -72,6 +72,6 @@ func OriginnalCodeUsingHttplibPassCtx(ctx context.Context) (*http.Response, erro
|
||||
return httplib.Get("http://localhost:7777/abc").DoRequestWithCtx(ctx)
|
||||
}
|
||||
|
||||
func OriginalCodeUsingHttplib() (*http.Response, error){
|
||||
func OriginalCodeUsingHttplib() (*http.Response, error) {
|
||||
return httplib.Get("http://localhost:7777/abc").DoRequest()
|
||||
}
|
||||
|
||||
@@ -78,4 +78,4 @@ func AddDefaultFilter(fc FilterChain) {
|
||||
defaultSetting.FilterChains = make([]FilterChain, 0, 4)
|
||||
}
|
||||
defaultSetting.FilterChains = append(defaultSetting.FilterChains, fc)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user