Use Canvas::HTTP instead of raw Net::HTTP

fixes gh-337

Change-Id: I146f84e1441703824ddb92feef47d9abc7a68daa
Reviewed-on: https://gerrit.instructure.com/23364
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Graham Ballantyne 2013-08-15 13:46:36 -07:00 committed by Simon Williams
parent ee1837fc74
commit 352f23c0d3
1 changed files with 2 additions and 2 deletions

View File

@ -59,8 +59,8 @@ class ExternalContentController < ApplicationController
endpoint = params[:endpoint]
url = params[:url]
uri = URI.parse(endpoint + (endpoint.match(/\?/) ? '&url=' : '?url=') + CGI.escape(url) + '&format=json')
res = Net::HTTP.get(uri) rescue "{}"
data = JSON.parse(res) rescue {}
res = Canvas::HTTP.get(uri.to_s) rescue '{}'
data = JSON.parse(res.body) rescue {}
if data['type']
if data['type'] == 'photo' && data['url'].try(:match, /^http/)
@retrieved_data = {