lib/requests/request.rb in video_chat_get-0.1.5 vs lib/requests/request.rb in video_chat_get-0.1.6
- old
+ new
@@ -3,20 +3,19 @@
require 'nokogiri'
require 'open-uri'
def request_json_parse(url)
- body_dic={}
client=HTTPClient.new()
response=client.get(url)
if response.status==200
- body_dic=JSON.parse(response.body)
+ return JSON.parse(response.body),response.status
end
- return body_dic,response.status
+ return nil,response.status
end
def request_html_parse(url,opt)
@@ -26,9 +25,12 @@
charset=f.charset
status=f.status
f.read
end
- response_body=Nokogiri::HTML.parse(response,nil,charset)
- return response_body,status
+ if status[0]=="200"
+ return Nokogiri::HTML.parse(response,nil,charset),status
+ end
+
+ return nil,status
end
\ No newline at end of file