Skip to content

A library for translating HTTP request and response objects for various clients into a common representation.

License

Notifications You must be signed in to change notification settings

viktorsheshenya/httpadapter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTPAdapter

Homepage
httpadapter.rubyforge.org
Author
Bob Aman
Copyright
Copyright © 2010 Google, Inc.
License
Apache 2.0

Description

A library for translating HTTP request and response objects for various clients into a common representation.

Reference

  • {HTTPAdapter}

Adapters

  • {HTTPAdapter::NetHTTPAdapter}
  • {HTTPAdapter::RackAdapter}
  • {HTTPAdapter::TyphoeusAdapter}

Example Usage

adapter = HTTPAdapter::NetHTTPAdapter.new
response = Net::HTTP.start('www.google.com', 80) { |http| http.get('/') }
# => #<Net::HTTPOK 200 OK readbody=true>
result = adapter.adapt_response(response)
# => [
#   200,
#   [
#     ["Expires", "-1"],
#     ["Content-Type", "text/html; charset=ISO-8859-1"],
#     ["X-Xss-Protection", "1; mode=block"],
#     ["Server", "gws"],
#     ["Date", "Thu, 26 Aug 2010 22:13:03 GMT"],
#     ["Set-Cookie", "<snip>"],
#     ["Cache-Control", "private, max-age=0"],
#     ["Transfer-Encoding", "chunked"]
#   ],
#   ["<snip>"]
# ]

Install

  • sudo gem install httpadapter

About

A library for translating HTTP request and response objects for various clients into a common representation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%