Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5.0 #36

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

v0.5.0 #36

wants to merge 5 commits into from

Conversation

hpopp
Copy link
Member

@hpopp hpopp commented Jul 3, 2018

  • :params option for query param encoding
  • Synchronous GET/POST/etc requests that don't require a pid

@hpopp
Copy link
Member Author

hpopp commented Jul 29, 2018

Tentative API

Kadabra.get("https://http2.golang.org/")
Kadabra.post("https://http2.golang.org/", body: "whatever", params: "yeah")
Kadabra.request(%Kadabra.Request{...}) # Shouldn't be directly used in the majority of cases

# Use a specific connection
pid = Kadabra.open("https://http2.golang.org/", ssl: some_opts)
Kadabra.get("https://http2.golang.org/", to: pid)
Kadabra.get("/", to: pid) # Should be able to ignore full url if conn is already open
Kadabra.close(pid)

# Async Handling
Kadabra.get("https://http2.golang.org/", on_response: fn resp ->
  case resp do
    %Kadabra.Response{} = response -> # success logic
    %Kadabra.Error{} = error -> # connection failure of some kind
  end
end)

Available Request Options

  • body
  • headers
  • params - Keyword list that will get automatically url encoded
  • on_response - If not supplied, request is synchronous
  • to - Forward to specific connection

Available Connection Options

  • ssl - :ssl opts
  • tcp - :gen_tcp opts
  • on_response - For handling pings and connection closes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant