mirror of
https://github.com/appleboy/drone-discord.git
synced 2026-06-04 18:33:47 +08:00
fix: fix error handling for empty HTTP responses
- Change the condition to check for `http.StatusNoContent` instead of `http.StatusOK` before returning an error. Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -283,7 +283,7 @@ func (p *Plugin) SendMessage(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusNoContent {
|
||||||
return fmt.Errorf("failed to send message, status code: %d", resp.StatusCode)
|
return fmt.Errorf("failed to send message, status code: %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user