Class: MiniProxy::Stub::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/miniproxy/stub/response.rb

Overview

MiniProxy stub response, so stubbed requests can return a custom response

Instance Method Summary collapse

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

#bodyObject



11
12
13
# File 'lib/miniproxy/stub/response.rb', line 11

def body
  @body || ""
end

#codeObject



15
16
17
# File 'lib/miniproxy/stub/response.rb', line 15

def code
  200
end

#headersObject



19
20
21
# File 'lib/miniproxy/stub/response.rb', line 19

def headers
  @headers || { "Content-Type" => "text/html" }
end