Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codedge-llc/kadabra
HTTP/2 client for Elixir
https://github.com/codedge-llc/kadabra
elixir elixir-lang http2 web
Last synced: 4 days ago
JSON representation
HTTP/2 client for Elixir
- Host: GitHub
- URL: https://github.com/codedge-llc/kadabra
- Owner: codedge-llc
- License: mit
- Created: 2016-09-29T18:45:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-02T19:53:39.000Z (6 months ago)
- Last Synced: 2025-02-05T21:51:51.707Z (16 days ago)
- Topics: elixir, elixir-lang, http2, web
- Language: Elixir
- Homepage: https://hex.pm/packages/kadabra
- Size: 313 KB
- Stars: 44
- Watchers: 7
- Forks: 23
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/codedge-llc/kadabra)
[](https://coveralls.io/github/codedge-llc/kadabra?branch=master)
[](https://hex.pm/packages/kadabra)
[](https://hex.pm/packages/kadabra)# Kadabra
HTTP/2 client for Elixir
Written to manage HTTP/2 connections for [pigeon](https://github.com/codedge-llc/pigeon). Very much a work in progress.
## Installation
_Requires Elixir 1.6/OTP 19.2 or later._
Add kadabra to your `mix.exs`:
```elixir
def deps do
[
{:kadabra, "~> 0.6.1"}
]
end
```## Usage
```elixir
{:ok, pid} = Kadabra.open("https://http2.codedge.dev")
Kadabra.get(pid, "/")
receive do
{:end_stream, %Kadabra.Stream.Response{} = stream} ->
IO.inspect stream
after 5_000 ->
IO.puts "Connection timed out."
end%Kadabra.Stream.Response{
body: "\\n\\nGo + HTTP/2
\\n\\nWelcome to..."
headers: [
{":status", "200"},
{"content-type", "text/html; charset=utf-8"},
{"content-length", "1708"},
{"date", "Sun, 16 Oct 2016 21:20:47 GMT"}
],
id: 1,
status: 200
}
```## Making Requests Manually
```elixir
{:ok, pid} = Kadabra.open("https://http2.codedge.dev")path = "/ECHO" # Route echoes PUT body in uppercase
body = "sample echo request"
headers = [
{":method", "PUT"},
{":path", path},
]Kadabra.request(pid, headers, body)
receive do
{:end_stream, %Kadabra.Stream.Response{} = stream} ->
IO.inspect stream
after 5_000 ->
IO.puts "Connection timed out."
end%Kadabra.Stream.Response{
body: "SAMPLE ECHO REQUEST",
headers: [
{":status", "200"},
{"content-type", "text/plain; charset=utf-8"},
{"date", "Sun, 16 Oct 2016 21:28:15 GMT"}
],
id: 1,
status: 200
}
```## Contributing
### Testing
Unit tests can be run with `mix test` or `mix coveralls.html`.
### Formatting
This project uses Elixir's `mix format` and [Prettier](https://prettier.io) for formatting.
Add hooks in your editor of choice to run it after a save. Be sure it respects this project's
`.formatter.exs`.### Commits
Git commit subjects use the [Karma style](http://karma-runner.github.io/5.0/dev/git-commit-msg.html).
## License
Copyright (c) 2016-2024 Codedge LLC (https://www.codedge.io/)
This library is MIT licensed. See the [LICENSE](https://github.com/codedge-llc/kadabra/blob/master/LICENSE) for details.