mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-16 20:21:33 +00:00
Report fetch outcome in webhook response.
This commit is contained in:
14
src/pages.go
14
src/pages.go
@@ -248,13 +248,19 @@ func postPage(w http.ResponseWriter, r *http.Request) error {
|
||||
switch result.outcome {
|
||||
case FetchError:
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
fmt.Fprintf(w, "fetch error: %s\n", result.err)
|
||||
case FetchTimeout:
|
||||
w.WriteHeader(http.StatusGatewayTimeout)
|
||||
default:
|
||||
fmt.Fprintln(w, "fetch timeout")
|
||||
case FetchNoChange:
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
if result.err != nil {
|
||||
fmt.Fprintln(w, result.err)
|
||||
fmt.Fprintln(w, "unchanged")
|
||||
case FetchCreated:
|
||||
w.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintln(w, "created")
|
||||
case FetchUpdated:
|
||||
w.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintln(w, "updated")
|
||||
}
|
||||
return result.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user