Files
pkgstash/handlerApi.go
T
2026-04-15 14:13:28 -06:00

18 lines
414 B
Go

package main
import (
"net/http"
)
func (s *Server) handlerRefresh(w http.ResponseWriter, req *http.Request) {
if req.Header.Get("Authorization") != "Bearer "+s.cfg.Auth.Token {
http.Error(w, "unauthorized", http.StatusInternalServerError)
return
}
if err := s.c.Refresh(); err != nil {
http.Error(w, "refresh failed", http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusNoContent)
}