I’m wondering if I’m doing something stupid here. I have a _javascript_ routine that does a GET on a foreign endpoint via a proxy class that Don gave me but I keep getting back an empty file whether the proxy is called by the _javascript_ or by sticking the http://localhost:3000/proxy/uri=... directly into the browser address (response below is ‘no response text’) where calling the endpoint by sticking that into a browser address returns the correct file. Can anyone see what I’m doing wrong?
Thanks,
Tony.
=======================
Rails (uri=’http://localhost:8080/sac/mysac?metadata’)
====
# Proxy controller
require 'net/http'
require 'uri'
class ProxyController < ApplicationController
# GET /proxy
def proxy
query = CGIMethods.parse_query_parameters(request.query_string)
uri = URI.parse(query['uri'])
response = Net::HTTP.start(uri.host, uri.port) { |http|
http.get(uri.path)
}
send_data(response.body, :type => response['content-type'],
:status => "#{response.code} #{response.message}")
end
end
=======================
--
Tony Linde
Project Manager
Department of Physics & Astronomy
University of Leicester