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()
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ func (r *Request) send() error {
|
||||
retries := r.Operation.Config.ConnectionRetries + 1
|
||||
for {
|
||||
if retries > 0 {
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"Sending request: [%d] %s %s",
|
||||
convert.StringToUnixTimestamp(r.HTTPRequest.Header.Get("Date"), convert.RFC822),
|
||||
r.Operation.RequestMethod,
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ type SomeActionInput struct {
|
||||
Date *time.Time `json:"Date" name:"Date" format:"RFC 822" location:"headers"`
|
||||
IfModifiedSince *time.Time `json:"If-Modified-Since" name:"If-Modified-Since" format:"RFC 822" location:"headers"`
|
||||
Range *string `json:"Range" name:"Range" location:"headers"`
|
||||
UploadID *string `json:"upload_id" name:"upload_id" location:"params"`
|
||||
UploadID *string `json:"upload_id" name:"upload_id" location:"query"`
|
||||
Count *int `json:"count" name:"count" location:"elements"`
|
||||
}
|
||||
|
||||
|
||||
+11
-9
@@ -85,11 +85,11 @@ func (qss *QingStorSigner) BuildSignature(request *http.Request) (string, error)
|
||||
signature := strings.TrimSpace(base64.StdEncoding.EncodeToString(h.Sum(nil)))
|
||||
authorization := "QS " + qss.AccessKeyID + ":" + signature
|
||||
|
||||
logger.Debug(fmt.Sprintf(
|
||||
logger.Debugf(fmt.Sprintf(
|
||||
"QingStor authorization: [%d] %s",
|
||||
convert.StringToUnixTimestamp(request.Header.Get("Date"), convert.RFC822),
|
||||
authorization),
|
||||
)
|
||||
authorization,
|
||||
))
|
||||
|
||||
return authorization, nil
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (qss *QingStorSigner) BuildQuerySignature(request *http.Request, expires in
|
||||
qss.AccessKeyID, expires, signature,
|
||||
)
|
||||
|
||||
logger.Debug(fmt.Sprintf(
|
||||
logger.Debugf(fmt.Sprintf(
|
||||
"QingStor query signature: [%d] %s",
|
||||
convert.StringToUnixTimestamp(request.Header.Get("Date"), convert.RFC822),
|
||||
query,
|
||||
@@ -141,7 +141,7 @@ func (qss *QingStorSigner) BuildStringToSign(request *http.Request) (string, err
|
||||
}
|
||||
stringToSign += canonicalizedResource
|
||||
|
||||
logger.Debug(fmt.Sprintf(
|
||||
logger.Debugf(fmt.Sprintf(
|
||||
"QingStor string to sign: [%d] %s",
|
||||
convert.StringToUnixTimestamp(request.Header.Get("Date"), convert.RFC822),
|
||||
stringToSign,
|
||||
@@ -167,7 +167,7 @@ func (qss *QingStorSigner) BuildQueryStringToSign(request *http.Request, expires
|
||||
}
|
||||
stringToSign += canonicalizedResource
|
||||
|
||||
logger.Debug(fmt.Sprintf(
|
||||
logger.Debugf(fmt.Sprintf(
|
||||
"QingStor query string to sign: [%d] %s",
|
||||
convert.StringToUnixTimestamp(request.Header.Get("Date"), convert.RFC822),
|
||||
stringToSign,
|
||||
@@ -208,7 +208,7 @@ func (qss *QingStorSigner) buildCanonicalizedResource(request *http.Request) (st
|
||||
parts := []string{}
|
||||
for _, key := range keys {
|
||||
values := query[key]
|
||||
if qss.paramsToSign(key) {
|
||||
if qss.queryToSign(key) {
|
||||
if len(values) > 0 {
|
||||
if values[0] != "" {
|
||||
value := strings.TrimSpace(strings.Join(values, ""))
|
||||
@@ -231,7 +231,7 @@ func (qss *QingStorSigner) buildCanonicalizedResource(request *http.Request) (st
|
||||
path = path + "?" + joinedParts
|
||||
}
|
||||
|
||||
logger.Debug(fmt.Sprintf(
|
||||
logger.Debugf(fmt.Sprintf(
|
||||
"QingStor canonicalized resource: [%d] %s",
|
||||
convert.StringToUnixTimestamp(request.Header.Get("Date"), convert.RFC822),
|
||||
path,
|
||||
@@ -240,7 +240,7 @@ func (qss *QingStorSigner) buildCanonicalizedResource(request *http.Request) (st
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func (qss *QingStorSigner) paramsToSign(key string) bool {
|
||||
func (qss *QingStorSigner) queryToSign(key string) bool {
|
||||
keysMap := map[string]bool{
|
||||
"acl": true,
|
||||
"cors": true,
|
||||
@@ -252,6 +252,8 @@ func (qss *QingStorSigner) paramsToSign(key string) bool {
|
||||
"upload_id": true,
|
||||
"uploads": true,
|
||||
"image": true,
|
||||
"lifecycle": true,
|
||||
"logging": true,
|
||||
"response-expires": true,
|
||||
"response-cache-control": true,
|
||||
"response-content-type": true,
|
||||
|
||||
+4
-4
@@ -69,7 +69,7 @@ func (b *BaseUnpacker) exposeStatusCode() error {
|
||||
if value.IsValid() {
|
||||
switch value.Interface().(type) {
|
||||
case *int:
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor response status code: [%d] %d",
|
||||
convert.StringToUnixTimestamp(b.httpResponse.Header.Get("Date"), convert.RFC822),
|
||||
b.httpResponse.StatusCode,
|
||||
@@ -82,7 +82,7 @@ func (b *BaseUnpacker) exposeStatusCode() error {
|
||||
}
|
||||
|
||||
func (b *BaseUnpacker) parseResponseHeaders() error {
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor response headers: [%d] %s",
|
||||
convert.StringToUnixTimestamp(b.httpResponse.Header.Get("Date"), convert.RFC822),
|
||||
fmt.Sprint(b.httpResponse.Header),
|
||||
@@ -145,7 +145,7 @@ func (b *BaseUnpacker) parseResponseBody() error {
|
||||
buffer.ReadFrom(b.httpResponse.Body)
|
||||
b.httpResponse.Body.Close()
|
||||
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor response body string: [%d] %s",
|
||||
convert.StringToUnixTimestamp(b.httpResponse.Header.Get("Date"), convert.RFC822),
|
||||
string(buffer.Bytes()),
|
||||
@@ -168,7 +168,7 @@ func (b *BaseUnpacker) parseResponseElements() error {
|
||||
buffer.ReadFrom(b.httpResponse.Body)
|
||||
b.httpResponse.Body.Close()
|
||||
|
||||
logger.Info(fmt.Sprintf(
|
||||
logger.Infof(fmt.Sprintf(
|
||||
"QingStor response body string: [%d] %s",
|
||||
convert.StringToUnixTimestamp(b.httpResponse.Header.Get("Date"), convert.RFC822),
|
||||
string(buffer.Bytes()),
|
||||
|
||||
Reference in New Issue
Block a user