From 454214e78be73afa8784d283ac0aa01baeacc996 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Thu, 9 Jul 2026 20:08:37 -0700 Subject: Use PUT for the API --- roseh.moe.go | 7 +++++-- 1 file 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") -- cgit v1.3.1