From b98663966c17ebbb39f1f1fad2b8718973d9c87b Mon Sep 17 00:00:00 2001 From: Jason Goodwin Date: Fri, 23 Feb 2024 16:27:43 -0800 Subject: [PATCH] fix(aws): missing verb at interface. This is a bit different than the og version so I missed this --- aws.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/aws.go b/aws.go index 7b4a376..4a83415 100644 --- a/aws.go +++ b/aws.go @@ -44,6 +44,8 @@ func (plugin AwsPlugin) ServeHTTP(rw http.ResponseWriter, req *http.Request) { switch req.Method { case http.MethodPut: plugin.put(rw, req) + case http.MethodPost: + plugin.post(rw, req) case http.MethodGet: plugin.get(rw, req) default: @@ -63,6 +65,17 @@ func (plugin *AwsPlugin) put(rw http.ResponseWriter, req *http.Request) { handleResponse(resp, err, rw) } +func (plugin *AwsPlugin) post(rw http.ResponseWriter, req *http.Request) { + payload, err := io.ReadAll(req.Body) + if err != nil { + rw.WriteHeader(http.StatusNotAcceptable) + log.Error(fmt.Sprintf("Reading body failed: %s", err.Error())) + return + } + resp, err := plugin.service.Post(req.URL.Path[1:], payload, req.Header.Get("Content-Type"), rw) + handleResponse(resp, err, rw) +} + func (plugin *AwsPlugin) get(rw http.ResponseWriter, req *http.Request) { resp, err := plugin.service.Get(req.URL.Path[1:], rw) handleResponse(resp, err, rw)