use w.Write instead of fmt.Fprintln
This commit is contained in:
parent
232d9caad3
commit
477970b0a6
|
@ -1,7 +1,6 @@
|
||||||
package twdataloader
|
package twdataloader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -14,7 +13,7 @@ func prepareTestServer(resp string) *httptest.Server {
|
||||||
return httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case EndpointGetServers:
|
case EndpointGetServers:
|
||||||
_, err := fmt.Fprintln(w, resp)
|
_, err := w.Write([]byte(resp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue