mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
http hook should accept more than 200 statusCode (#13180)
Co-authored-by: Klaus Post <klauspost@gmail.com>
This commit is contained in:
parent
39d51ce845
commit
2807c11410
@ -98,7 +98,7 @@ func (h *Target) Init() error {
|
|||||||
// Drain any response.
|
// Drain any response.
|
||||||
xhttp.DrainBody(resp.Body)
|
xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if !acceptedResponseStatusCode(resp.StatusCode) {
|
||||||
switch resp.StatusCode {
|
switch resp.StatusCode {
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set",
|
return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set",
|
||||||
@ -112,6 +112,13 @@ func (h *Target) Init() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Accepted HTTP Status Codes
|
||||||
|
var acceptedStatusCodeMap = map[int]bool{http.StatusOK: true, http.StatusCreated: true, http.StatusAccepted: true, http.StatusNoContent: true}
|
||||||
|
|
||||||
|
func acceptedResponseStatusCode(code int) bool {
|
||||||
|
return acceptedStatusCodeMap[code]
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Target) startHTTPLogger() {
|
func (h *Target) startHTTPLogger() {
|
||||||
// Create a routine which sends json logs received
|
// Create a routine which sends json logs received
|
||||||
// from an internal channel.
|
// from an internal channel.
|
||||||
|
Loading…
Reference in New Issue
Block a user