nghttp
nghttp
A client for HTTP goodness. Inspired by python-requests and daily need.
Installation
Add this to your application's shard.yml
:
dependencies:
nghttp:
github: bmmcginty/nghttp
Usage
require "nghttp"
# Create a session.
# It can persist cookies and connections.
s=NGHTTP::Session.new
# Override the user-agent header.
s.headers["User-Agent"]="New User-Agent"
# Enable the cache.
s.config.cache=true
s.config.cache_expires=1.hours
body = s.get"https://example.org/") do |resp|
resp.xml
end
Testing
Clone httpbin. git clone https://github.com/bmmcginty/httpbin
Add to nginx.conf for keep-alive testing:
location /conn {
default_type application/json;
return 200 '{"connection": "$connection", "connection_requests": "$connection_requests", "connection_time": "$connection_time"}';
}
See spec/nghttp_spec.cr
.
Development
Most code can be found in the handlers directory.
Contributing
- Fork it ( https://github.com/bmmcginty/nghttp/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- bmmcginty Brandon McGinty - creator, maintainer
Repository
nghttp
Owner
Statistic
- 0
- 0
- 0
- 1
- 0
- 4 months ago
- January 9, 2019
License
MIT License
Links
Synced at
Fri, 06 Jun 2025 13:44:25 GMT
Languages