vendor: update all dependencies to latest versions
This commit is contained in:
+7
-7
@@ -39,7 +39,7 @@ import (
|
||||
type BaseBuilder struct {
|
||||
parsedURL string
|
||||
parsedProperties *map[string]string
|
||||
parsedParams *map[string]string
|
||||
parsedQuery *map[string]string
|
||||
parsedHeaders *map[string]string
|
||||
parsedBodyString string
|
||||
parsedBody io.Reader
|
||||
@@ -76,7 +76,7 @@ func (b *BaseBuilder) build() (*http.Request, error) {
|
||||
}
|
||||
|
||||
func (b *BaseBuilder) parse() (*BaseBuilder, error) {
|
||||
err := b.parseRequestParamsAndHeaders()
|
||||
err := b.parseRequestQueryAndHeaders()
|
||||
if err != nil {
|
||||
return b, err
|
||||
}
|
||||
@@ -96,15 +96,15 @@ func (b *BaseBuilder) parse() (*BaseBuilder, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (b *BaseBuilder) parseRequestParamsAndHeaders() error {
|
||||
requestParams := map[string]string{}
|
||||
func (b *BaseBuilder) parseRequestQueryAndHeaders() error {
|
||||
requestQuery := map[string]string{}
|
||||
requestHeaders := map[string]string{}
|
||||
maps := map[string](map[string]string){
|
||||
"params": requestParams,
|
||||
"query": requestQuery,
|
||||
"headers": requestHeaders,
|
||||
}
|
||||
|
||||
b.parsedParams = &requestParams
|
||||
b.parsedQuery = &requestQuery
|
||||
b.parsedHeaders = &requestHeaders
|
||||
|
||||
if !b.input.IsValid() {
|
||||
@@ -280,7 +280,7 @@ func (b *BaseBuilder) setupHeaders(httpRequest *http.Request) error {
|
||||
body.Seek(0, 0)
|
||||
length = end - start
|
||||
default:
|
||||
return errors.New("Can not get Content-Length")
|
||||
return errors.New("can not get Content-Length")
|
||||
}
|
||||
if length > 0 {
|
||||
httpRequest.ContentLength = length
|
||||
|
||||
+4
-4
@@ -33,9 +33,9 @@ type FakeProperties struct {
|
||||
CD *int `name:"c-d"`
|
||||
}
|
||||
type FakeInput struct {
|
||||
ParamA *string `location:"params" name:"a"`
|
||||
ParamB *string `location:"params" name:"b"`
|
||||
ParamCD *int `location:"params" name:"c_d" default:"1024"`
|
||||
ParamA *string `location:"query" name:"a"`
|
||||
ParamB *string `location:"query" name:"b"`
|
||||
ParamCD *int `location:"query" name:"c_d" default:"1024"`
|
||||
HeaderA *string `location:"headers" name:"A"`
|
||||
HeaderB *time.Time `location:"headers" name:"B" format:"RFC 822"`
|
||||
HeaderCD *int `location:"headers" name:"C-D"`
|
||||
@@ -109,7 +109,7 @@ func TestBaseBuilder_BuildHTTPRequest(t *testing.T) {
|
||||
assert.Equal(t, &map[string]string{
|
||||
"a": "param_a",
|
||||
"c_d": "1024",
|
||||
}, builder.parsedParams)
|
||||
}, builder.parsedQuery)
|
||||
assert.Equal(t, &map[string]string{
|
||||
"A": "header_a",
|
||||
"B": "Thu, 01 Sep 2016 07:30:00 GMT",
|
||||
|
||||
+5
-5
@@ -75,20 +75,20 @@ func (qb *QingStorBuilder) BuildHTTPRequest(o *data.Operation, i *reflect.Value)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"Built QingStor request: [%d] %s",
|
||||
convert.StringToUnixTimestamp(httpRequest.Header.Get("Date"), convert.RFC822),
|
||||
httpRequest.URL.String()),
|
||||
)
|
||||
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor request headers: [%d] %s",
|
||||
convert.StringToUnixTimestamp(httpRequest.Header.Get("Date"), convert.RFC822),
|
||||
fmt.Sprint(httpRequest.Header)),
|
||||
)
|
||||
|
||||
if qb.baseBuilder.parsedBodyString != "" {
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor request body string: [%d] %s",
|
||||
convert.StringToUnixTimestamp(httpRequest.Header.Get("Date"), convert.RFC822),
|
||||
qb.baseBuilder.parsedBodyString),
|
||||
@@ -120,9 +120,9 @@ func (qb *QingStorBuilder) parseURL() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if qb.baseBuilder.parsedParams != nil {
|
||||
if qb.baseBuilder.parsedQuery != nil {
|
||||
queryValue := requestURL.Query()
|
||||
for key, value := range *qb.baseBuilder.parsedParams {
|
||||
for key, value := range *qb.baseBuilder.parsedQuery {
|
||||
queryValue.Set(key, value)
|
||||
}
|
||||
requestURL.RawQuery = queryValue.Encode()
|
||||
|
||||
Reference in New Issue
Block a user