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

[BO-834] Add delete_association method to Factiva::Monitoring #20

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
monitoring: handle empty response body on make_request method
  • Loading branch information
DaniPB committed Jan 16, 2025
commit 87591b57d41f4a897f5f1c49fce134239e0997e0
2 changes: 1 addition & 1 deletion lib/factiva/monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def make_request(http_method, url, params = nil)
.auth("Bearer #{auth.token}")
.send(*http_params)

response_body = JSON.parse(response.body.to_s)
response_body = response.body.to_s.empty? ? {} : JSON.parse(response.body.to_s)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a record is deleted, Factiva answers with 200 and an empty response body, this will bomb and raise a JSON::ParserError. This change is to avoid that.


if response.status.success?
Success(response_body)
Expand Down