checking response in Net::HTTP

S

Skave Rat

How can I check if a requested document has a specific status (i.e. 200)
when using NET::HTTP?
 
T

Todd Fisher

Skave said:
How can I check if a requested document has a specific status (i.e. 200)
when using NET::HTTP?


This works for me:

Net::HTTPResponse::CODE_TO_OBJ.select { |k,v| v == response.class
}.first[0].to_i rescue 500
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
sxarexu

Latest Threads

Top