그래서 내가 만든 돌출이 같은 컨트롤러 :HTTP 요청 경로가 인터넷 : HTTP 작업에 비어
는require 'net/http'
class HowdyController < ApplicationController
def show
url = URI.parse("http://google.com")
req = Net::HTTP::Get.new(url.path)
@resp = Net::HTTP.new(url.host, url.port).start {|http| http.request(req)}
end
end
내 경로는 다음과 같이이다 :
get "howdy/show"
내보기는 거짓말이다 이 :
<h1>Howdy#show</h1>
<%= "The call to example.com returned this: #{@resp}" %>
하지만 http://localhost:3000/howdy/show
에 갈 때이 오류가
HTTP 요청 경로가 비어 있습니다
내가 HTTP : 인터넷 바로 작동하는 간단한 뭔가를 만들려고하는 완전히 새로운 오전!
좋아 여전히 같은 오류가 발생, 그것을 시도. –
이상한, 나를 위해 노력하고 있습니다. 이것을 시도하십시오 : @ resp.body 반환 – fmendez