Class: HttpStub::Server::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/server/response.rb

Constant Summary collapse

OK =
ok.freeze
NOT_FOUND =
HttpStub::Server::Stub::Response.create(status: 404, body: "NOT FOUND").freeze
EMPTY =
HttpStub::Server::Stub::Response.create.freeze

Class Method Summary collapse

Class Method Details

.invalid_request(cause) ⇒ Object



12
13
14
# File 'lib/http_stub/server/response.rb', line 12

def invalid_request(cause)
  HttpStub::Server::Stub::Response.create(status: 400, body: cause.to_s)
end

.ok(opts = {}) ⇒ Object



8
9
10
# File 'lib/http_stub/server/response.rb', line 8

def ok(opts={})
  HttpStub::Server::Stub::Response.create({ body: "OK" }.merge(opts).merge(status: 200))
end