I faced a unique issue, that certain woocommerce plugins cause the HTTParty response to have a BOM character which is very troublesome and JSON.parse will cause an Unexpected Token Error
The solution I came across was to pass additional parameters in JSON.parse for the HTTParty Response in plain format
I faced a unique issue, that certain woocommerce plugins cause the HTTParty response to have a BOM character which is very troublesome and
JSON.parse
will cause anUnexpected Token Error
The solution I came across was to pass additional parameters inJSON.parse
for the HTTParty Response in plain formatJSON.parse(response.encode('utf-8', 'binary', :undef => :replace, :replace => ''))
The change allows us to change the default HTTParty
format:
argument toplain:
, if required.