Sha256: b3a9c54866d8a751fc1c096e3db1974a2c026207d0c185da9a5967e02db0898a

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

module Praxis
  module RequestStages

    class Response < RequestStage

      def execute
        response = controller.response

        response.handle

        config = Application.current_instance.config
        if config.praxis.validate_responses == true
          validate_body = config.praxis.validate_response_bodies

          response.validate(action, validate_body: validate_body)
        end
      rescue Exceptions::Validation => e
        controller.response = validation_handler.handle!(
          summary: "Error validating response", 
          exception: e,
          request: request,
          stage: name, 
          errors: e.errors
        )
        retry
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praxis-0.22.pre.2 lib/praxis/request_stages/response.rb
praxis-0.22.pre.1 lib/praxis/request_stages/response.rb