diff options
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 7 |
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") |
