Sha256: 9043a57d0e7d48454059dab3db1898d55c5796321a79fd28bc6fff477f316842
Contents?: true
Size: 734 Bytes
Versions: 48
Compression:
Stored size: 734 Bytes
Contents
require 'pact/consumer/mock_service/rack_request_helper' module Pact module MockService module RequestHandlers class BaseRequestHandler NOT_FOUND_RESPONSE = [404, {}, []].freeze include Pact::Consumer::RackRequestHelper def match? env raise NotImplementedError end def call env match?(env) ? respond(env) : NOT_FOUND_RESPONSE end def json_response json = nil, status = 200 [status, {'Content-Type' => 'application/json'}, json ? [json + "\n"]: []] end def text_response text = nil, status = 200 [status, {'Content-Type' => 'text/plain'}, text ? [text + "\n"]: []] end end end end end
Version data entries
48 entries across 48 versions & 2 rubygems