notify/wechat: adjust result check sequence. (#2044)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
bc6dd0dd46
commit
7d21f5a5a9
|
@ -171,16 +171,16 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
|
|||
}
|
||||
defer notify.Drain(resp)
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return true, fmt.Errorf("unexpected status code %v", resp.StatusCode)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
level.Debug(n.logger).Log("response", string(body), "incident", key)
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return true, fmt.Errorf("unexpected status code %v", resp.StatusCode)
|
||||
}
|
||||
|
||||
var weResp weChatResponse
|
||||
if err := json.Unmarshal(body, &weResp); err != nil {
|
||||
return true, err
|
||||
|
|
Loading…
Reference in New Issue