From 650e4262061f679619a73b74e1cf14062fb71a10 Mon Sep 17 00:00:00 2001 From: LukeHackett12 Date: Mon, 20 Mar 2023 11:29:58 +0000 Subject: [PATCH] Add content type to lock file post --- app/obolapi/api.go | 1 + app/obolapi/api_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/app/obolapi/api.go b/app/obolapi/api.go index d8ddbea1e..784288b34 100644 --- a/app/obolapi/api.go +++ b/app/obolapi/api.go @@ -60,6 +60,7 @@ func httpPost(ctx context.Context, url *url.URL, b []byte) error { if err != nil { return errors.Wrap(err, "new POST request with ctx") } + req.Header.Add("Content-Type", `application/json`) res, err := new(http.Client).Do(req) if err != nil { diff --git a/app/obolapi/api_test.go b/app/obolapi/api_test.go index dc203db4e..2e11be9b6 100644 --- a/app/obolapi/api_test.go +++ b/app/obolapi/api_test.go @@ -23,6 +23,7 @@ func TestLockPublish(t *testing.T) { t.Run("2xx response", func(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { require.Equal(t, r.URL.Path, "/lock") + require.Equal(t, r.Header.Get("Content-Type"), "application/json") data, err := io.ReadAll(r.Body) require.NoError(t, err)