diff --git a/lib/discourse_chat/provider/matrix/matrix_provider.rb b/lib/discourse_chat/provider/matrix/matrix_provider.rb index d051a0f..c70af25 100644 --- a/lib/discourse_chat/provider/matrix/matrix_provider.rb +++ b/lib/discourse_chat/provider/matrix/matrix_provider.rb @@ -64,7 +64,7 @@ module DiscourseChat if !response.kind_of?(Net::HTTPSuccess) error_key = nil begin - responseData = response.parsed_body + responseData = JSON.parse(response.body) if responseData['errcode'] == "M_UNKNOWN_TOKEN" error_key = 'chat_integration.provider.matrix.errors.unknown_token' elsif responseData['errcode'] == "M_UNKNOWN" diff --git a/lib/discourse_chat/provider/slack/slack_provider.rb b/lib/discourse_chat/provider/slack/slack_provider.rb index f30eda5..93bf9fd 100644 --- a/lib/discourse_chat/provider/slack/slack_provider.rb +++ b/lib/discourse_chat/provider/slack/slack_provider.rb @@ -125,7 +125,7 @@ module DiscourseChat::Provider::SlackProvider raise ::DiscourseChat::ProviderError.new info: { request: uri, response_code: response.code, response_body: response.body } end - json = response.parsed_body + json = JSON.parse(response.body) unless json["ok"] == true if json.key?("error") && (json["error"] == ('channel_not_found') || json["error"] == ('is_archived')) diff --git a/lib/discourse_chat/provider/slack/slack_transcript.rb b/lib/discourse_chat/provider/slack/slack_transcript.rb index ef6be10..803a01f 100644 --- a/lib/discourse_chat/provider/slack/slack_transcript.rb +++ b/lib/discourse_chat/provider/slack/slack_transcript.rb @@ -208,7 +208,7 @@ module DiscourseChat::Provider::SlackProvider req.set_form_data(token: SiteSetting.chat_integration_slack_access_token, limit: 200, cursor: cursor) response = http.request(req) return false unless response.kind_of? Net::HTTPSuccess - json = response.parsed_body + json = JSON.parse(response.body) return false unless json['ok'] cursor = json['response_metadata']['next_cursor'] json['members'].each do |user| @@ -244,7 +244,7 @@ module DiscourseChat::Provider::SlackProvider req.set_form_data(data) response = http.request(req) return false unless response.kind_of? Net::HTTPSuccess - json = response.parsed_body + json = JSON.parse(response.body) return false unless json['ok'] raw_messages = json['messages'] diff --git a/lib/discourse_chat/provider/telegram/telegram_provider.rb b/lib/discourse_chat/provider/telegram/telegram_provider.rb index 9072db5..c8d4d7e 100644 --- a/lib/discourse_chat/provider/telegram/telegram_provider.rb +++ b/lib/discourse_chat/provider/telegram/telegram_provider.rb @@ -44,7 +44,7 @@ module DiscourseChat req.body = message.to_json response = http.request(req) - responseData = response.parsed_body + responseData = JSON.parse(response.body) responseData end