There is a link to JSON. Information it parsed in RoR application.
Sometimes on a remote server instead of JSON'and you receive a 503 error saying the server is currently unavailable.
url = 'this url'
uri = URI(url)
response = Net::HTTP.get(uri)
data = JSON.parse(response)
How to implement the test? For example, how to test what is received from the server? I want to implement a check for "JSON'ness".
You can of course first check the status of the server response, Mr. may, is there any other option provided for in Ruby/RoR in conjunction with the JSON class?
In General, all statuses are unambiguous. So you need to try to only get 200 status. All others are considered incorrect for data processing. - Maggie18 commented on July 9th 19 at 10:56
If you need to tackle on the knee, then of course it is possible and 400 to parse, if you are satisfied with the data. Well, it's nomination for bad smelling code ) - Maggie18 commented on July 9th 19 at 11:02