优化响应状态码提取
This commit is contained in:
parent
7e71a76959
commit
6569f7d114
@ -290,7 +290,11 @@ func send(apiConfig *ApiRequestConfig, header map[string]string) *ApiResponse {
|
|||||||
}
|
}
|
||||||
// 提取响应错误码
|
// 提取响应错误码
|
||||||
if response.RequestConfig.ResponseCodeFieldLocation == ResponseCodeFieldLocationHeader {
|
if response.RequestConfig.ResponseCodeFieldLocation == ResponseCodeFieldLocationHeader {
|
||||||
|
if strings.ToLower(response.RequestConfig.ResponseCodeField) == "http_code" {
|
||||||
|
response.Code = responseHttpCode
|
||||||
|
} else {
|
||||||
response.Code = response.Response.Header.Get(response.RequestConfig.ResponseCodeField)
|
response.Code = response.Response.Header.Get(response.RequestConfig.ResponseCodeField)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
businessCode := gjson.GetBytes(responseByte, response.RequestConfig.ResponseCodeField)
|
businessCode := gjson.GetBytes(responseByte, response.RequestConfig.ResponseCodeField)
|
||||||
if businessCode.Exists() {
|
if businessCode.Exists() {
|
||||||
|
Loading…
Reference in New Issue
Block a user