Closed gwyCl closed 10 months ago
Okay, I understand the reason now. The response type is text/plain. What should I do to handle this? Could you give me some suggestions?
resp, err := client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Clustername", clusterName).
SetBody(map[string]string{
"serviceName": j.Uk,
"deployment": j.Env,
}).Post(fmt.Sprintf(config.SearchK8sTappUrl, clusterName))
if err != nil {
err = fmt.Errorf("getDockerfile err %s resp %s", err, resp.String())
return
}
var response Response
err = json.Unmarshal([]byte(resp.String()), &response)
if err != nil {
err = fmt.Errorf("json unmarshal err %s resp %s", err, resp.String())
return
}