+8
-8
src/pages.go
+8
-8
src/pages.go
···
244
244
entryPath := sitePath
245
245
entry := (*Entry)(nil)
246
246
appliedRedirect := false
247
-
status := 200
247
+
status := http.StatusOK
248
248
reader := io.ReadSeeker(nil)
249
249
mtime := time.Time{}
250
250
for {
···
276
276
}
277
277
}
278
278
if entry == nil || entry.GetType() == Type_InvalidEntry {
279
-
status = 404
279
+
status = http.StatusNotFound
280
280
if entryPath != notFoundPage {
281
281
entryPath = notFoundPage
282
282
continue
···
832
832
err := error(nil)
833
833
switch r.Method {
834
834
// REST API
835
-
case http.MethodOptions:
835
+
case "OPTIONS":
836
836
// no preflight options
837
-
case http.MethodHead, http.MethodGet:
837
+
case "HEAD", "GET":
838
838
err = getPage(w, r)
839
-
case http.MethodPut:
839
+
case "PUT":
840
840
err = putPage(w, r)
841
-
case http.MethodPatch:
841
+
case "PATCH":
842
842
err = patchPage(w, r)
843
-
case http.MethodDelete:
843
+
case "DELETE":
844
844
err = deletePage(w, r)
845
845
// webhook API
846
-
case http.MethodPost:
846
+
case "POST":
847
847
err = postPage(w, r)
848
848
default:
849
849
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)