Sha256: ff7aef497e8f60113c1a9ec7ea102a7af441371820e25e4709e2c6b787c7311b

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

require 'uri'
require 'certified'
require 'http/parser'
require 'http/version'

require 'http/chainable'
require 'http/client'
require 'http/mime_type'
require 'http/options'
require 'http/request'
require 'http/response'
require 'http/response_parser'
require 'http/uri_backport' if RUBY_VERSION < "1.9.0"

# HTTP should be easy
module Http
  extend Chainable

  # The method given was not understood
  class UnsupportedMethodError < ArgumentError; end

  # Valid HTTP methods
  METHODS = [:get, :head, :post, :put, :delete, :trace, :options, :connect, :patch]

  # Matches HTTP header names when in "Canonical-Http-Format"
  CANONICAL_HEADER = /^[A-Z][a-z]*(-[A-Z][a-z]*)*$/

  # CRLF is the universal HTTP delimiter
  CRLF = "\r\n"

  class << self
    # Http[:accept => 'text/html'].get(...)
    alias_method :[], :with_headers

    # Transform to canonical HTTP header capitalization
    def canonicalize_header(header)
      header.to_s.split(/[\-_]/).map(&:capitalize).join('-')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
http-0.3.0 lib/http.rb