aboutsummaryrefslogtreecommitdiff
path: root/api.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-09-26 08:40:41 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-09-26 08:40:41 +0200
commit706ff58a6f6608719feda15075d50f978df39c5b (patch)
treed0b655454d5e13ed2238060fee27fc0d951d64c8 /api.go
parentd8633d7fb89b55996f25e1a67180408c805ba15f (diff)
downloadguichet-706ff58a6f6608719feda15075d50f978df39c5b.tar.gz
guichet-706ff58a6f6608719feda15075d50f978df39c5b.zip
format
Diffstat (limited to 'api.go')
-rw-r--r--api.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/api.go b/api.go
index 73fd322..e99fce5 100644
--- a/api.go
+++ b/api.go
@@ -1,8 +1,8 @@
package main
import (
- "errors"
"encoding/json"
+ "errors"
"fmt"
"github.com/gorilla/mux"
"net/http"
@@ -12,7 +12,7 @@ func handleAPIWebsiteList(w http.ResponseWriter, r *http.Request) {
user := RequireUserApi(w, r)
if user == nil {
- return
+ return
}
ctrl, err := NewWebsiteController(user)
@@ -40,7 +40,7 @@ func handleAPIWebsiteInspect(w http.ResponseWriter, r *http.Request) {
user := RequireUserApi(w, r)
if user == nil {
- return
+ return
}
bucketName := mux.Vars(r)["bucket"]
@@ -86,7 +86,7 @@ func handleAPIWebsiteInspect(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPatch {
var patch WebsitePatch
err := json.NewDecoder(r.Body).Decode(&patch)
- if err != nil {
+ if err != nil {
http.Error(w, errors.Join(fmt.Errorf("Can't parse the request body as a website patch JSON"), err).Error(), http.StatusBadRequest)
return
}
@@ -98,7 +98,7 @@ func handleAPIWebsiteInspect(w http.ResponseWriter, r *http.Request) {
} else if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
- }
+ }
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(view)
@@ -119,7 +119,7 @@ func handleAPIWebsiteInspect(w http.ResponseWriter, r *http.Request) {
}
w.WriteHeader(http.StatusNoContent)
return
-
+
}
http.Error(w, "This method is not implemented for this endpoint", http.StatusNotImplemented)