Sha256: c71f19c3fa3ded65a10ff4322b91d22c9874918b56ad95d3f7062fda7ac4651e

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module Pragma
  module Operation
    class Response
      # Represents the 401 Unauthorized HTTP response.
      class Unauthorized < Response
        # Initializes the response.
        #
        # @param entity [Object] the response's entity
        # @param headers [Hash] the response's headers
        def initialize(
          entity: Error.new(
            error_type: :unauthorized,
            error_message: 'This resource requires authentication.'
          ),
          headers: {}
        )
          super(status: 401, entity: entity, headers: headers)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pragma-operation-2.2.0 lib/pragma/operation/response/unauthorized.rb