mspanc

mspanc

Membrane Core Team

Integration testing fake HTTP server

Hello,

I am writing an app that is accessing a HTTP server via HTTPoison and shoud be very resillent when it comes to error handling. I would like to make some integration tests and spawn some fake HTTP server from Elixir in order to handle responses. It should be able to e.g. break TCP connection after some data sent (in order to simulate broken connection).

Does anyone know any project that can ease such task? I would prefer to avoid reimplementing HTTP server.

Most Liked

sribe

sribe

Not that I have ever find. It was on my to-do list at a prior job, but never found time. My boss even had a nick-name for the idea “WWW Server”, short for “world’s worst web server” :wink:

I think the fundamental problem is that there is no web server anywhere that was designed with this kind of idea in mind: “when you respond to this specific upcoming request, drop the connection halfway through sending the headers”, or “never finish sending the body”, etc…

mertonium

mertonium

I’ve had success using bypass as a “fake” server for tests. Although I don’t if it is possible to have it simulate a broken connection.

Qqwy

Qqwy

TypeCheck Core Team

This is a very interesting idea, and something that Elixir would be very well-suited for, I think :D.

Where Next?

Popular in Questions Top

vonH
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
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Fl4m3Ph03n1x
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
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement