Module: Faraday::CLI::Option::Validator

Extended by:
Validator
Included in:
Validator
Defined in:
lib/faraday/cli/option/validator.rb

Constant Summary collapse

ALLOWED_HTTP_METHODS =
%w(get head post put patch delete options)

Instance Method Summary collapse

Instance Method Details

#validate(argv, options_hash) ⇒ Object



6
7
8
9
10
# File 'lib/faraday/cli/option/validator.rb', line 6

def validate(argv,options_hash)
  validate_url(argv[0])
  validate_http_method(options_hash)
  validate_http_headers(options_hash)
end

#validate_http_headers(options_hash) ⇒ Object



12
13
14
# File 'lib/faraday/cli/option/validator.rb', line 12

def validate_http_headers(options_hash)
  alert('header is in malformed format!') if options_hash[:http_headers].any?{|pairs| pairs.length != 2  }
end