http_client
Version, currently main branch1 version
- main branchlatestJul 12, 2026
github.com/jgaskins/http_client
Pooling-enabled HTTP client for Crystal
9 stars
4 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
http_client:
github: jgaskins/http_client
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.13.0- License
- MIT
- Author
- Jamie Gaskins
Dependencies
Runtime Dependencies
- db*github: crystal-lang/crystal-db
Development Dependencies
- http_client*path: .dev
README
HTTPClient
A HTTP client that transparently pools connections. You can use it anywhere you would use an HTTP::Client because it is an HTTP::Client.
Installation
-
Add the dependency to your
shard.yml:dependencies: http_client: github: jgaskins/http_client -
Run
shards install
Usage
require "http_client"
http = HTTPClient.new(URI.parse("https://api.example.com"))
http.get "/"
# => #<HTTP::Client::Response:...>
OAuth
Using a pooled HTTP client allows you to use a single OAuth2::Client instance for your entire app.
require "oauth2"
require "http_client"
EXAMPLE_OAUTH2 = OAuth2::Client.new(
host: "api.example.com",
client_id: ENV["OAUTH2_CLIENT_ID"],
client_secret: ENV["OAUTH2_CLIENT_SECRET"],
redirect_uri: ENV["OAUTH2_REDIRECT_URI"],
)
EXAMPLE_OAUTH2.http_client = HTTPClient.new("https://api.example.com")
Contributing
- Fork it (https://github.com/jgaskins/http_client/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
- Jamie Gaskins - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jul 12, 2026
- Crystal
>= 1.13.0- Indexed
- yes
Dependents
Repository
github.com/jgaskins/http_client
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 30, 2026
- Synced
- Sep 30, 2026
- Versions
- 1