Skip to content

Commit

Permalink
Fix for issue #71 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexei Tighineanu authored Nov 15, 2020
1 parent ad97e5d commit d84e49d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/services/rocketchat/rocketchat.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ func (service *Service) Send(message string, params *types.Params) error {
apiURL := buildURL(config)
json, _ := CreateJSONPayload(config, message, params)
res, err := http.Post(apiURL, "application/json", bytes.NewReader(json))

if err != nil {
return fmt.Errorf("Error while posting to URL: %v", err)
}
if res.StatusCode != http.StatusOK {
return fmt.Errorf("failed to send notification to service, response status code %s", res.Status)
}
Expand All @@ -44,4 +46,3 @@ func (service *Service) Send(message string, params *types.Params) error {
func buildURL(config *Config) string {
return fmt.Sprintf("https://%s/hooks/%s/%s", config.Host, config.TokenA, config.TokenB)
}

0 comments on commit d84e49d

Please sign in to comment.