Sha256: c4ba27fe976673ff8db5e1042debb9ccd159fdafccd98024f084accb45fdf3e1
Contents?: true
Size: 815 Bytes
Versions: 19
Compression:
Stored size: 815 Bytes
Contents
# frozen_string_literal: true module Salestation class Web < Module module InputValidators class AcceptHeader include Deterministic::Prelude def self.[](*allowed_headers) new(allowed_headers) end def initialize(allowed_headers) @allowed_headers = allowed_headers end def call(header_value) header_valid = @allowed_headers.empty? || @allowed_headers.include?(header_value) if header_valid Success(nil) else Failure(App::Errors::NotAcceptable.new( message: "Unsupported Accept Header '#{header_value}'", debug_message: "Available Accept Headers are #{@allowed_headers.join(', ')}" )) end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems