mirror of
https://github.com/iv-org/instances-api.git
synced 2025-05-31 20:34:33 -04:00
Check for valid JSON
This commit is contained in:
parent
8e56425c3b
commit
19ac3692b8
1 changed files with 4 additions and 2 deletions
|
@ -83,11 +83,13 @@ spawn do
|
|||
req = client.get("/api/v1/trending")
|
||||
if req.status_code == 200
|
||||
begin
|
||||
JSON.parse(req.body)
|
||||
api = true
|
||||
if req.headers["Access-Control-Allow-Origin"] == "*"
|
||||
cors = true
|
||||
end
|
||||
|
||||
trending = JSON.parse(req.body)
|
||||
trending[0]["videoId"].as_s()
|
||||
api = true
|
||||
rescue
|
||||
puts "Cant parse API json"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue