Sha256: b447875057b3fa98e80fcf83934d4ec4afe852e6312f737a5269375848babca8
Contents?: true
Size: 841 Bytes
Versions: 10
Compression:
Stored size: 841 Bytes
Contents
module RspecApiDocs class Resource class Example class RequestHeaders attr_reader :env def self.call(*args) new(*args).call end def initialize(env) @env = env end def call headers.reject do |k, v| excluded_headers.include?(k) end end private # http://stackoverflow.com/a/33235714/826820 def headers Hash[ *env.select { |k, v| k.start_with? 'HTTP_' } .collect { |k, v| [k.sub(/^HTTP_/, ''), v] } .collect { |k, v| [k.split('_').collect(&:capitalize).join('-'), v] } .sort.flatten ] end def excluded_headers RspecApiDocs.configuration.exclude_request_headers end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems