Class: Gem::WebauthnListener::Response
- Inherits:
-
Object
- Object
- Gem::WebauthnListener::Response
- Defined in:
- lib/rubygems/webauthn_listener/response.rb
Direct Known Subclasses
BadRequestResponse, MethodNotAllowedResponse, NoContentResponse, NotFoundResponse, OkResponse
Instance Attribute Summary collapse
-
#http_response ⇒ Object
readonly
Returns the value of attribute http_response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(host) ⇒ Response
Returns a new instance of Response.
34 35 36 37 38 |
# File 'lib/rubygems/webauthn_listener/response.rb', line 34 def initialize(host) @host = host build_http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
28 29 30 |
# File 'lib/rubygems/webauthn_listener/response.rb', line 28 def http_response @http_response end |
Class Method Details
.for(host) ⇒ Object
30 31 32 |
# File 'lib/rubygems/webauthn_listener/response.rb', line 30 def self.for(host) new(host) end |
Instance Method Details
#to_s ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/rubygems/webauthn_listener/response.rb', line 40 def to_s status_line = "HTTP/#{@http_response.http_version} #{@http_response.code} #{@http_response.}\r\n" headers = @http_response.to_hash.map {|header, value| "#{header}: #{value.join(", ")}\r\n" }.join + "\r\n" body = @http_response.body ? "#{@http_response.body}\n" : "" status_line + headers + body end |