Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛Error parsing valid JSON response #65

Open
rhec opened this issue Jun 3, 2019 · 2 comments
Open

🐛Error parsing valid JSON response #65

rhec opened this issue Jun 3, 2019 · 2 comments
Labels

Comments

@rhec
Copy link

rhec commented Jun 3, 2019

Description

The JSON response from the server is failing to parse, because bamboozled is passing a HTTParty::Response object to JSON.parse. This will raise an exception: ArgumentError: strict_parse() expected a String or IO Object. That exception is caught, and bamboozled attempts to parse the JSON as XML, which also fails and raises an exception. That exception is not caught.

Expected behavior

The JSON from the server is parsed and returned.

How To Reproduce

irb(main):004:0> client = Bamboozled.client(subdomain: "<subdomain redacted>", api_key: "<api key redacted>")
irb(main):005:0> client.employee.all
MultiXml::ParseError: 1:1: FATAL: Start tag expected, '<' not found
	from (irb):5

Environment

Ruby 2.4.5

Dependencies:
httparty (0.13.3)
json (1.8.6)

Potential solution

Change JSON.parse(response) to JSON.parse(response.body) in base.rb.

@splybon
Copy link
Contributor

splybon commented Jul 3, 2019

@rhec thanks for the issue! Sorry it's taken a while to get back to you. The change you put in looks pretty good.

I'm having a hard to replicating the issue though. I'm guessing it has to do with the response that bamboo is giving you. Would you be able to paste in the response that you are getting back from bamboo?

@splybon
Copy link
Contributor

splybon commented Aug 16, 2019

@rhec we just updated the gem versions to httparty and json with bamboozled version 0.3.0. Can you see if that magically fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants