Skip to content

v0.5.0#36

Open
hpopp wants to merge 5 commits intomasterfrom
feat/params
Open

v0.5.0#36
hpopp wants to merge 5 commits intomasterfrom
feat/params

Conversation

@hpopp
Copy link
Copy Markdown
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
Copy Markdown
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