tangui
PlugLoopback - a library to call your own endpoints
Hello community ![]()
I’ve recently released plug_loopback, a library to programmatically call your own (Phoenix) endpoints:
You can form a new request from a Phoenix endpoint:
MyAppWeb.Endpoint
|> PlugLoopback.from_phoenix_endpoint()
|> PlugLoopback.get("/some/path", [{"some", "header"}])
|> Plug.Conn.put_req_header("another", "header")
|> PlugLoopback.run()
or replay any Plug.Conn{}:
conn
|> PlugLoopback.replay()
|> PlugLoopback.run() # Here is a very good opportunity to create an infinite loop!
I needed it to implement the stale-while-revalidate cache-control header in plug_http_cache, but it can be useful for other uses-cases:
- warming up cache at startup by directly calling the pages you want to cache
- debugging in the shell
- and probably others
It’s very similar to Phoenix.ConnTest but intends to be more production-ready (replays / auto-encodes the body, simple API) and possibly be Phoenix-independant in the future.
Any suggestion or contribution is welcome.
Cheers ![]()
Most Liked
aifrak
Thanks for the library.
Just wanted to let you know that the Github link is not working. It shows me a 404.
1
Popular in Libraries
The latest release of Ace (0.10.0) includes serving content over HTTP/2.
I have started writing a webserver to teach my self more about...
New
Hey everyone!
Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
Presenting Aviacommerce, open source e-commerce platform in Elixir
Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
What is ContEx?
A pure Elixir server-side data plotting/charting library outputting SVG.
It has nice barcharts in particular and works g...
New
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
I’ve just released the first version of Snap, an Elasticsearch client. It borrows ideas about application structure and process managemen...
New
Hey everyone,
I just released WebSockex which is a Elixir WebSocket client.
WebSockex strives to work as a OTP special process, be RFC6...
New
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components.
We also have a boi...
New
Other popular topics
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New







