summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-07-09 20:08:37 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-07-09 20:08:37 -0700
commit454214e78be73afa8784d283ac0aa01baeacc996 (patch)
tree099be3b7c9509c753a1147e583310cca375a9598 /roseh.moe.go
parentde52ffdd1412590ea733942500534f62cfa1b84c (diff)
downloadroseh.moe-454214e78be73afa8784d283ac0aa01baeacc996.tar.zst
Use PUT for the API
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 6ac91e9..f71761c 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -499,8 +499,11 @@ func wormholeAPIUpload(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Failed to write hole file", http.StatusInternalServerError)
return
}
+ resultURL := fmt.Sprintf("%s/wormhole/%s", *selfURL, hole)
w.Header().Set("Content-Type", "text/plain")
- fmt.Fprintf(w, "%s/wormhole/%s\n", *selfURL, hole)
+ w.Header().Set("Location", resultURL)
+ w.WriteHeader(http.StatusCreated)
+ fmt.Fprintln(w, resultURL)
}
func wormholeDownload(w http.ResponseWriter, r *http.Request) {
@@ -852,7 +855,7 @@ func main() {
mux.Handle("GET /code/", http.StripPrefix("/code/", http.FileServer(http.Dir(*codeDir))))
mux.HandleFunc("GET /static/", static)
mux.HandleFunc("GET /favicon.ico", favicon)
- mux.HandleFunc("POST /api/wormhole/{name}", wormholeAPIUpload)
+ mux.HandleFunc("PUT /api/wormhole/{name}", wormholeAPIUpload)
mux.HandleFunc("GET /", notFound)
http.Handle("/", http.NewCrossOriginProtection().Handler(mux))
jellyfinURL, err := url.Parse("http://127.0.0.1:8096")