Permalink
Browse files

Alter raw_request to return transport errors.

  • Loading branch information...
1 parent 7158e5e commit a58e41e43a65b7b3b62ac75b1b5dd1f2983fa9d6 @archaelus archaelus committed Jun 14, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/cowboy_client.erl
View
@@ -89,10 +89,13 @@ raw_request(Data, Client=#client{state=response_body}) ->
{done, Client2} = skip_body(Client),
raw_request(Data, Client2);
raw_request(Data, Client=#client{
- state=State, socket=Socket, transport=Transport})
- when State =:= request ->
- ok = Transport:send(Socket, Data),
- {ok, Client}.
+ state=request, socket=Socket, transport=Transport}) ->
+ case Transport:send(Socket, Data) of
+ ok ->
+ {ok, Client};
+ {error, _} = Err ->
+ Err
+ end.
request(Method, URL, Client) ->
request(Method, URL, [], <<>>, Client).

0 comments on commit a58e41e

Please sign in to comment.