Skip to content

Commit

Permalink
support statusCode for response
Browse files Browse the repository at this point in the history
  • Loading branch information
yndu13 committed May 26, 2022
1 parent 5dc8bbe commit c0156b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
35 changes: 21 additions & 14 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,8 +1213,9 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime

if tea.BoolValue(util.EqualString(params.BodyType, tea.String("binary"))) {
resp := map[string]interface{}{
"body": response_.Body,
"headers": response_.Headers,
"body": response_.Body,
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}
_result = resp
return _result, _err
Expand All @@ -1226,8 +1227,9 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime

_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"body": byt,
"headers": response_.Headers,
"body": byt,
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
return _result, _err
} else if tea.BoolValue(util.EqualString(params.BodyType, tea.String("string"))) {
Expand All @@ -1238,8 +1240,9 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime

_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"body": tea.StringValue(str),
"headers": response_.Headers,
"body": tea.StringValue(str),
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
return _result, _err
} else if tea.BoolValue(util.EqualString(params.BodyType, tea.String("json"))) {
Expand All @@ -1251,8 +1254,9 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime
res := util.AssertAsMap(obj)
_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"body": res,
"headers": response_.Headers,
"body": res,
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
return _result, _err
} else if tea.BoolValue(util.EqualString(params.BodyType, tea.String("array"))) {
Expand All @@ -1263,14 +1267,16 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime

_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"body": arr,
"headers": response_.Headers,
"body": arr,
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
return _result, _err
} else {
_result = make(map[string]interface{})
_err = tea.Convert(map[string]map[string]*string{
"headers": response_.Headers,
_err = tea.Convert(map[string]interface{}{
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
return _result, _err
}
Expand Down Expand Up @@ -1416,8 +1422,9 @@ func (client *Client) Execute(params *Params, request *OpenApiRequest, runtime *
}
_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"headers": interceptorContext.Response.Headers,
"body": interceptorContext.Response.DeserializedBody,
"headers": interceptorContext.Response.Headers,
"statusCode": tea.IntValue(interceptorContext.Response.StatusCode),
"body": interceptorContext.Response.DeserializedBody,
}, &_result)
return _result, _err
}()
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ require (
github.com/alibabacloud-go/openapi-util v0.0.11
github.com/alibabacloud-go/tea v1.1.17
github.com/alibabacloud-go/tea-utils v1.4.3
github.com/alibabacloud-go/tea-xml v1.1.2
github.com/aliyun/credentials-go v1.1.2
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
)

0 comments on commit c0156b6

Please sign in to comment.