mirror of
https://github.com/iv-org/instances-api.git
synced 2025-06-07 06:12:54 -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")
|
req = client.get("/api/v1/trending")
|
||||||
if req.status_code == 200
|
if req.status_code == 200
|
||||||
begin
|
begin
|
||||||
JSON.parse(req.body)
|
|
||||||
api = true
|
|
||||||
if req.headers["Access-Control-Allow-Origin"] == "*"
|
if req.headers["Access-Control-Allow-Origin"] == "*"
|
||||||
cors = true
|
cors = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trending = JSON.parse(req.body)
|
||||||
|
trending[0]["videoId"].as_s()
|
||||||
|
api = true
|
||||||
rescue
|
rescue
|
||||||
puts "Cant parse API json"
|
puts "Cant parse API json"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue