Skip to content

Commit

Permalink
Fix response encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
dapi committed Nov 19, 2023
1 parent 37986d6 commit 82d9dcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/moysklad/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def initialize login: nil, password: nil, logger: nil
else
conn.request(:authorization, :basic, login, password)
end

conn.adapter Faraday.default_adapter
end
end

Expand Down Expand Up @@ -79,6 +81,7 @@ def logger

def parse_response res
body = res.body
body.force_encoding 'utf-8' if res.body.encoding.to_s == "ASCII-8BIT" && res.headers['content-type'].include?('charset=utf-8')
Moysklad.logger.debug "Response [#{res.status}] with body #{body}"

if res.status == 200
Expand Down
2 changes: 1 addition & 1 deletion lib/moysklad/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Moysklad
VERSION = '0.4.5'
VERSION = '0.4.6'
end

0 comments on commit 82d9dcf

Please sign in to comment.