mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
fix: bugs (#208)
* fix: add iam roles to permissions * fix: show state initial on usersearch * fix: search project roles returns only roles of project * fix: add project member owner on project create * fix: create new object oon failed event * feat: parse error body on chat message * feat: remove comment
This commit is contained in:
@@ -3,8 +3,10 @@ package chat
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/caos/logging"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/notification/providers"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"unicode/utf8"
|
||||
@@ -51,10 +53,19 @@ func (chat *Chat) SendMessage(message providers.Message) error {
|
||||
return caos_errs.ThrowInternal(err, "PROVI-s8uie", "Could not unmarshal content")
|
||||
}
|
||||
|
||||
_, err = http.Post(chat.URL.String(), "application/json; charset=UTF-8", bytes.NewReader(req))
|
||||
response, err := http.Post(chat.URL.String(), "application/json; charset=UTF-8", bytes.NewReader(req))
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "PROVI-si93s", "unable to send message")
|
||||
}
|
||||
if response.StatusCode != 200 {
|
||||
defer response.Body.Close()
|
||||
bodyBytes, err := ioutil.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "PROVI-PSLd3", "unable to read response message")
|
||||
}
|
||||
logging.LogWithFields("PROVI-PS0kx", "Body", string(bodyBytes)).Warn("Chat Message post didnt get 200 OK")
|
||||
return caos_errs.ThrowInternal(nil, "PROVI-LSopw", string(bodyBytes))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user