mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-13 19:02:15 +01:00
fix(webhook/client): error on http status codes >= 400
This commit is contained in:
committed by
Julien Neuhart
parent
1f784ad44c
commit
1de0f4c4fa
@@ -3,6 +3,7 @@ package webhook
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -78,6 +79,10 @@ func (c client) send(body io.Reader, headers map[string]string, erroed bool) err
|
||||
return fmt.Errorf("send '%s' request to '%s': %w", method, URL, err)
|
||||
}
|
||||
|
||||
if resp.StatusCode >= http.StatusBadRequest {
|
||||
return fmt.Errorf("send '%s' request to '%s': got status: '%s'", method, URL, resp.Status)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := resp.Body.Close()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user