"I am trying to write a test for an HTTPS client. To do that, I mock the server behaviour as follows:
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
resp := `{ here some JSON }`
w.Write([]byte(resp))
}))
However, this approach does not work because I have an HTTPS client, and I get the following error: "server gave HTTP response to HTTPS client"
How can I make the server return HTTPS response?
Aucun commentaire:
Enregistrer un commentaire