diff --git a/webclient/client_test.go b/webclient/client_test.go index a8b4719..f1afd33 100644 --- a/webclient/client_test.go +++ b/webclient/client_test.go @@ -21,11 +21,6 @@ type DummyHttpClient struct { requests []RecordedRequest } -func (d *DummyHttpClient) Post(url string, contentType string, data io.Reader) (*http.Response, error) { - d.requests = append(d.requests, RecordedRequest{method: http.MethodPost, url: url, contentType: contentType, data: data}) - return nil, nil -} - func (d *DummyHttpClient) Do(request *http.Request) (*http.Response, error) { d.requests = append(d.requests, RecordedRequest{method: request.Method, url: request.URL.String(), contentType: "", data: request.Body}) return nil, nil diff --git a/webclient/main.go b/webclient/main.go index 74f6b0c..76452aa 100644 --- a/webclient/main.go +++ b/webclient/main.go @@ -4,14 +4,12 @@ import ( "bytes" "encoding/json" "fmt" - "io" "net/http" daemon "spud/daemon" service_definition "spud/service_definition" ) type HttpClient interface { - Post(string, string, io.Reader) (*http.Response, error) Do(*http.Request) (*http.Response, error) } @@ -40,7 +38,8 @@ func (c WebClient) CreateService(def service_definition.ServiceDefinition) error serializedPayload, _ := json.Marshal(payload) - _, e := c.httpClient.Post(c.getBaseUrl()+"/service/", "application/json", bytes.NewBuffer(serializedPayload)) + req, _ := http.NewRequest(http.MethodPost, c.getBaseUrl()+"/service/", bytes.NewBuffer(serializedPayload)) + _, e := c.httpClient.Do(req) return e }