Class: MLserver::RedirectResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/MLserver/redirect_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, type: 302, httpver: "HTTP/1.1") ⇒ RedirectResponse

Returns a new instance of RedirectResponse.



3
4
5
6
7
# File 'lib/MLserver/redirect_response.rb', line 3

def initialize(url, type: 302, httpver: "HTTP/1.1")
  @type = type.to_i
  @url = url.to_s
  @httpver = httpver
end

Instance Method Details

#responseObject



9
10
11
# File 'lib/MLserver/redirect_response.rb', line 9

def response
  return Response.new(status: @type, headers: {Location: @url, Connection: "close"}, data: "Redirecting... If you don't get redirected, go to the following URL: #{@url}", httpver: @httpver)
end