mirror of
https://github.com/minio/minio.git
synced 2025-03-29 00:33:42 -04:00
all 2xx status codes to be success for audit (#20394)
This commit is contained in:
parent
64e803b136
commit
0f1e8db4c5
2
.github/workflows/vulncheck.yml
vendored
2
.github/workflows/vulncheck.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.22.5
|
go-version: 1.22.7
|
||||||
- name: Get official govulncheck
|
- name: Get official govulncheck
|
||||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -196,13 +196,15 @@ func (target *WebhookTarget) send(eventData event.Event) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer xhttp.DrainBody(resp.Body)
|
xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
|
||||||
return fmt.Errorf("sending event failed with %v", resp.Status)
|
// accepted HTTP status codes.
|
||||||
|
return nil
|
||||||
|
} else if resp.StatusCode == http.StatusForbidden {
|
||||||
|
return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", target.args.Endpoint, resp.Status)
|
||||||
}
|
}
|
||||||
|
return fmt.Errorf("%s returned '%s', please check your endpoint configuration", target.args.Endpoint, resp.Status)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendFromStore - reads an event from store and sends it to webhook.
|
// SendFromStore - reads an event from store and sends it to webhook.
|
||||||
|
@ -266,15 +266,13 @@ func (h *Target) send(ctx context.Context, payload []byte, payloadCount int, pay
|
|||||||
// Drain any response.
|
// Drain any response.
|
||||||
xhttp.DrainBody(resp.Body)
|
xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
switch resp.StatusCode {
|
if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
|
||||||
case http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNoContent:
|
|
||||||
// accepted HTTP status codes.
|
// accepted HTTP status codes.
|
||||||
return nil
|
return nil
|
||||||
case http.StatusForbidden:
|
} else if resp.StatusCode == http.StatusForbidden {
|
||||||
return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", h.Endpoint(), resp.Status)
|
return fmt.Errorf("%s returned '%s', please check if your auth token is correctly set", h.Endpoint(), resp.Status)
|
||||||
default:
|
|
||||||
return fmt.Errorf("%s returned '%s', please check your endpoint configuration", h.Endpoint(), resp.Status)
|
|
||||||
}
|
}
|
||||||
|
return fmt.Errorf("%s returned '%s', please check your endpoint configuration", h.Endpoint(), resp.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Target) startQueueProcessor(ctx context.Context, mainWorker bool) {
|
func (h *Target) startQueueProcessor(ctx context.Context, mainWorker bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user