Created
May 24, 2015 22:11
-
-
Save jordi-chacon/871ab45df432e0668740 to your computer and use it in GitHub Desktop.
Instruction 90 should timeout?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(87)> defmodule MyPlug do | |
...(87)> import Plug.Conn | |
...(87)> | |
...(87)> def init(options) do | |
...(87)> # initialize options | |
...(87)> | |
...(87)> options | |
...(87)> end | |
...(87)> | |
...(87)> def call(conn, _opts) do | |
...(87)> :timer.sleep(3000) | |
...(87)> conn |> send_resp(200, "burru") | |
...(87)> end | |
...(87)> end | |
iex:87: warning: redefining module MyPlug | |
{:module, MyPlug, | |
<<70, 79, 82, 49, 0, 0, 5, 244, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 185, 131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115, 95, 118, 49, 108, 0, 0, 0, 2, 104, 2, ...>>, | |
{:call, 2}} | |
iex(88)> {:ok, _} = Plug.Adapters.Cowboy.http MyPlug, [] | |
{:ok, #PID<0.716.0>} | |
iex(89)> HTTPoison.get("http://localhost:4000") | |
{:ok, | |
%HTTPoison.Response{body: "burru", | |
headers: %{"cache-control" => "max-age=0, private, must-revalidate", | |
"connection" => "keep-alive", "content-length" => "5", | |
"date" => "Sun, 24 May 2015 22:06:08 GMT", "server" => "Cowboy"}, | |
status_code: 200}} | |
iex(90)> HTTPoison.get("http://localhost:4000", [], [timeout: 1]) | |
{:ok, | |
%HTTPoison.Response{body: "burru", | |
headers: %{"cache-control" => "max-age=0, private, must-revalidate", | |
"connection" => "keep-alive", "content-length" => "5", | |
"date" => "Sun, 24 May 2015 22:06:18 GMT", "server" => "Cowboy"}, | |
status_code: 200}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment