Sha256: da979629e74661d55c8ad211672e12aa0ebb4e50d44b48fc47203ff70888fa63

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

module Pacto
  module Server
    class PlaybackServlet
      attr_reader :status, :headers, :body

      def initialize(attributes)
        @status = attributes.fetch(:status, 200)
        @headers = attributes.fetch(:headers, [])
        @body = attributes.fetch(:body, nil)
      end

      def do_GET(request, response) # rubocop:disable MethodName
        response.status = status
        headers.each do |key, value|
          response[key] = value
        end
        response.body = body
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pacto-0.3.1 spec/pacto/server/playback_servlet.rb
pacto-0.3.0 spec/pacto/server/playback_servlet.rb