davidantaramian / httpipe Goto Github PK
View Code? Open in Web Editor NEWHTTPipe is an adapter-driven HTTP library for Elixir that provides a way to build composable HTTP requests
License: Other
HTTPipe is an adapter-driven HTTP library for Elixir that provides a way to build composable HTTP requests
License: Other
I'm envisioning a system similar to Plug's parsers where a user can specify what module to use to parse what types of content. HTTPipe would then decode incoming requests based on the content-type
header into the decoded_body
key on the response.
I'm not sure if this makes sense in the context of this library, but if someone is interested, I'd like to know how you see it being used.
Currently URLs are stored as strings which isn't helpful in many situations beyond sending the request. By storing the URL in its composite pieces, it makes it easier to work with over time.
It would be nice if there was a function like this:
HTTPipe.Conn.new(%HTTPipe.Request{})
Example of how I am doing it now:
req = %HTTPipe.Request{
method: :post,
url: "/cloud/project/#{service_name}/user/#{user_id}/regeneratePassword"
}
Map.put(HTTPipe.Conn.new(), :request, req)
Would be nice if I could
%HTTPipe.Request{
method: :post,
url: "/cloud/project/#{service_name}/user/#{user_id}/regeneratePassword"
}
|> HTTPipe.Conn.new()
HTTPipe
, I think the field private
would be desirable.HTTPipe.Conn.t
which is not ideal.private
field.https://github.com/elixir-lang/plug/blob/v1.3.0/lib/plug/conn.ex#L163
@DavidAntaramian, your thoughts on this?
Is cookie support an interesting feature for anyone? What would the function calls look like to you?
Should it be possible to register functions that should be called before a connection is executed in order to modify the request in some fashion?
The specification would look something like this, allowing for both anonymous functions and named functions:
@type before_execute_fun :: (HTTPipe.Request.t -> HTTPipe.Request.t)
@spec register_before_execute(HTTPipe.Conn.t, before_execute_fun) :: Conn.t
@spec register_before_execute(HTTPipe.Conn.t, module, atom) :: Conn.t
In the second case, the atom would refer to a single-arity function in the given module with a spec of (HTTPipe.Request.t) :: HTTPipe.Request.t
.
One of my biggest concerns with the library currently is that pooling connections is dependent on the individual adapter. I'm open to ideas about a more canonical way to implement pooling at the library level rather than at the adapter level.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.