Web client needs to handle error responses
davidkel opened this issue · comments
Dave Kelsey commented
In platform/view/services/client/web/client.go
resp, err := c.c.Do(req)
if err != nil {
return nil, errors.Wrapf(err, "failed to process http request to [%s], input length [%d]", url, len(in))
}
buff, err := io.ReadAll(resp.Body)
if err != nil {
return nil, errors.Wrapf(err, "failed to read response from http request to [%s], input length [%d]", url, len(in))
}
response := &protos2.CommandResponse_CallViewResponse{}
err = json.Unmarshal(buff, response)
always assumes that the response will be a callviewresponse but this may not be the case. For example if you try to send http to an https server or if both are http and you try to call a view the response isn't of the format and you get unhelpful messages about the response