fix: handle different response

This commit is contained in:
Lakhan Samani
2022-07-17 17:05:35 +05:30
parent 70ea463f60
commit 882756ef3a
5 changed files with 9 additions and 19 deletions

View File

@@ -96,17 +96,9 @@ func TestEndpointResolver(ctx context.Context, params model.TestEndpointRequest)
return nil, err
}
response := map[string]interface{}{}
if string(body) != "" {
if err := json.Unmarshal(body, &response); err != nil {
log.Debug("error un-marshalling response: ", err)
return nil, err
}
}
statusCode := int64(resp.StatusCode)
return &model.TestEndpointResponse{
HTTPStatus: &statusCode,
Response: response,
Response: refs.NewStringRef(string(body)),
}, nil
}