func()

in oss/client_presign.go [140:164]


func (c *Client) unmarshalPresignOutput(result *PresignResult, output *OperationOutput) error {
	if chk, ok := c.options.Signer.(interface{ IsSignedHeader([]string, string) bool }); ok {
		header := map[string]string{}
		for k, v := range output.httpRequest.Header {
			if chk.IsSignedHeader(c.options.AdditionalHeaders, k) {
				header[k] = v[0]
			}
		}
		if len(header) > 0 {
			result.SignedHeaders = header
		}
	}
	result.Method = output.httpRequest.Method
	result.URL = output.httpRequest.URL.String()
	if signTime, ok := output.OpMetadata.Get(signer.SignTime).(time.Time); ok {
		result.Expiration = signTime
	}
	_, ok := c.options.Signer.(*signer.SignerV4)
	if ok {
		if !result.Expiration.IsZero() && (result.Expiration.After(time.Now().Add(7 * 24 * time.Hour))) {
			return fmt.Errorf("expires should be not greater than 604800(seven days)")
		}
	}
	return nil
}