Class: Mountebank::Stub::HttpResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/mountebank/stub/http_response.rb

Direct Known Subclasses

HttpsResponse

Instance Attribute Summary

Attributes inherited from Response

#inject, #is, #proxy

Class Method Summary collapse

Methods inherited from Response

#initialize, #to_json, with_injection

Constructor Details

This class inherits a constructor from Mountebank::Stub::Response

Class Method Details

.create(statusCode = 200, headers = {}, body = '') ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/mountebank/stub/http_response.rb', line 2

def self.create(statusCode=200, headers={}, body='')
  payload = {}
  payload[:statusCode] = statusCode
  payload[:headers] = headers unless headers.empty?
  payload[:body] = body unless body.empty?

  data = {is: payload}
  new(data)
end