Implémenter NotFoundResponse()

This commit is contained in:
Victor Lacasse-Beaudoin 2023-08-22 15:25:42 -04:00
parent 83d669b7a5
commit ba43df3e31
2 changed files with 11 additions and 23 deletions

View file

@ -130,7 +130,7 @@ func HandleFormulaires(c echo.Context) error {
func HandlePublicDocumentation(c echo.Context) error {
client, err := api.NewApiClientFromViper()
if err != nil {
return c.JSON(http.StatusNotFound, map[string]string{"message": "Not Found"})
return c.JSON(http.StatusNotFound, models.NotFoundResponse())
}
bucket := c.Param("bucket")
@ -138,7 +138,7 @@ func HandlePublicDocumentation(c echo.Context) error {
result, err := client.Call(http.MethodGet, fmt.Sprintf("/v1/bucket/%s/%s", bucket, document))
if err != nil {
return c.JSON(http.StatusNotFound, map[string]string{"message": "Not Found"})
return c.JSON(http.StatusNotFound, models.NotFoundResponse())
}
// Check if result can fit inside a map containing a message