Content-Type fixes in client4.ts and remote_cluster.go (#27887)

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Этот коммит содержится в:
Caleb Roseland
2024-09-12 10:21:06 -05:00
коммит произвёл GitHub
родитель b94a11e591
Коммит 84a0c09d56
4 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@@ -8848,11 +8848,12 @@ func (c *Client4) GenerateRemoteClusterInvite(ctx context.Context, remoteCluster
}
defer closeBody(r)
b, err := io.ReadAll(r.Body)
if err != nil {
return "", nil, NewAppError("GenerateRemoteClusterInvite", "api.read_error", nil, "", http.StatusInternalServerError).Wrap(err)
var inviteCode string
if err := json.NewDecoder(r.Body).Decode(&inviteCode); err != nil {
return "", nil, NewAppError("GenerateRemoteClusterInvite", "api.unmarshall_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
return string(b), BuildResponse(r), nil
return inviteCode, BuildResponse(r), nil
}
func (c *Client4) GetRemoteCluster(ctx context.Context, remoteClusterId string) (*RemoteCluster, *Response, error) {
@@ -8863,7 +8864,9 @@ func (c *Client4) GetRemoteCluster(ctx context.Context, remoteClusterId string)
defer closeBody(r)
var rc *RemoteCluster
json.NewDecoder(r.Body).Decode(&rc)
if err := json.NewDecoder(r.Body).Decode(&rc); err != nil {
return nil, nil, NewAppError("GetRemoteCluster", "api.unmarshall_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
return rc, BuildResponse(r), nil
}