diff options
| author | Leonardo Bishop <me@leonardobishop.net> | 2025-07-17 15:50:34 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.net> | 2025-07-17 15:50:34 +0100 |
| commit | b4a9e6d6c3c342b1f8e6d8a61190c53c0e9d4280 (patch) | |
| tree | b41f9e3a955f046d61048a4d113374cb51122b97 | |
| parent | eef40f0755d3f832d1088e9719aa476af76ff521 (diff) | |
Add not found handler to api mux
| -rw-r--r-- | api/handler/site.go | 2 | ||||
| -rw-r--r-- | api/mux.go | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/api/handler/site.go b/api/handler/site.go index 2e099c8..cb9e0e4 100644 --- a/api/handler/site.go +++ b/api/handler/site.go @@ -40,6 +40,8 @@ func UploadSiteVersion(mainConfig *config.MainConfig, index *index.SiteIndex) fu } slog.Info("new version created", "site", site, "version", version, "remoteAddr", r.RemoteAddr) + + w.WriteHeader(http.StatusCreated) fmt.Fprintf(w, "version created: %s", version) } } @@ -11,6 +11,7 @@ import ( func NewMux(cfg *config.MainConfig, siteIndex *index.SiteIndex) *http.ServeMux { mux := http.NewServeMux() mux.HandleFunc("POST /site/{site}/upload", handler.UploadSiteVersion(cfg, siteIndex)) + mux.HandleFunc("/", http.NotFoundHandler().ServeHTTP) return mux } |
