From b19238e1ccc1d862e9e9cc8ff9bd35d3f24f0262 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 23 Aug 2023 15:43:10 -0400 Subject: [PATCH] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20models.NotImp?= =?UTF-8?q?lementedResponse()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api_handlers/api_handlers.go | 5 ++--- models/responses.go | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api_handlers/api_handlers.go b/api_handlers/api_handlers.go index ceefded..1e8e232 100644 --- a/api_handlers/api_handlers.go +++ b/api_handlers/api_handlers.go @@ -258,6 +258,7 @@ func HandleV1DocumentCreate(c echo.Context) error { response.Data.Bucket = info.Bucket response.Data.Key = info.Key response.Data.Size = info.Size + return c.JSON(response.StatusCode, response) } @@ -334,9 +335,7 @@ func HandleV1DocumentRead(c echo.Context) error { // HandleV1DocumentUpdate permet de mettre à jour certains champs d'un object, comme le Content-Type ou le Filename func HandleV1DocumentUpdate(c echo.Context) error { - return c.JSON(http.StatusNotImplemented, map[string]string{ - "message": "Not Implemented", - }) + return c.JSON(models.NotImplementedResponse()) } // HandleV1DocumentDelete permet de supprimer un object diff --git a/models/responses.go b/models/responses.go index c759a6f..6890d37 100644 --- a/models/responses.go +++ b/models/responses.go @@ -1,5 +1,7 @@ package models +import "net/http" + type Responder interface { Respond() Responder } @@ -28,6 +30,12 @@ func NotFoundResponse() SimpleResponse { } } +func NotImplementedResponse() (int, SimpleResponse) { + return http.StatusNotImplemented, SimpleResponse{ + Message: "Not Implemented", + } +} + type HandleAdminDocumentsUploadResponse struct { Response Data struct { -- 2.45.2