Class: MiniProxy::Stub::Response
- Inherits:
-
Object
- Object
- MiniProxy::Stub::Response
- Defined in:
- lib/miniproxy/stub/response.rb
Overview
MiniProxy stub response, so stubbed requests can return a custom response
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
- #headers ⇒ Object
-
#initialize(headers:, body:) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(headers:, body:) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/miniproxy/stub/response.rb', line 6 def initialize(headers:, body:) @body = body @headers = headers end |
Instance Method Details
#body ⇒ Object
11 12 13 |
# File 'lib/miniproxy/stub/response.rb', line 11 def body @body || "" end |
#code ⇒ Object
15 16 17 |
# File 'lib/miniproxy/stub/response.rb', line 15 def code 200 end |
#headers ⇒ Object
19 20 21 |
# File 'lib/miniproxy/stub/response.rb', line 19 def headers @headers || { "Content-Type" => "text/html" } end |