Skip to content

Commit

Permalink
Merge pull request #17 from checkly/kjda/alert-channels
Browse files Browse the repository at this point in the history
removing id from createAlertChannel
  • Loading branch information
kjda authored Jan 11, 2021
2 parents 71a8c8e + ee81d33 commit 4700594
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions checkly.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func (c *Client) DeleteEnvironmentVariable(key string) error {
// the newly-created alert channel, or an error.
func (c *Client) CreateAlertChannel(ac AlertChannel) (*AlertChannel, error) {
payload := map[string]interface{}{
"id": ac.ID,
"type": ac.Type,
"config": ac.GetConfig(),
}
Expand All @@ -457,7 +456,7 @@ func (c *Client) CreateAlertChannel(ac AlertChannel) (*AlertChannel, error) {
if err != nil {
return nil, err
}
if status != http.StatusOK {
if status != http.StatusOK && status != http.StatusCreated {
return nil, fmt.Errorf("unexpected response status: %d, res: %q, payload: %v", status, res, string(data))
}
result := map[string]interface{}{}
Expand Down
1 change: 0 additions & 1 deletion checkly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,6 @@ func validateAlertChannel(t *testing.T, body []byte) {
t.Fatalf("decoding error for data %q: %v", body, err)
}
ac := checkly.AlertChannel{}
ac.ID = int64(response["id"].(float64))
ac.Type = response["type"].(string)
cfgJSON, err := json.Marshal(response["config"])
if err != nil {
Expand Down

0 comments on commit 4700594

Please sign in to comment.