Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rollback changes that used ewgi_api:content_type() to store/access th…

…e ewgi_response() Content-Type.
  • Loading branch information...
commit df5e1280c625accf1104224761ff5b5fb9a46751 1 parent 3664ab8
@davide davide authored
Showing with 11 additions and 7 deletions.
  1. +0 −2  include/ewgi.hrl
  2. +11 −5 src/ewgi_yaws.erl
View
2  include/ewgi.hrl
@@ -225,11 +225,9 @@
begin
error_logger:info_msg("Inpecting the final ewgi_response()...~n"
"Status: ~p~n"
- "Content-Type: ~p~n"
"Headers: ~p~n"
"Body: ~p~n",
[ewgi_api:response_status(Ctx),
- ewgi_api:content_type(Ctx),
ewgi_api:response_headers(Ctx),
ewgi_api:response_message_body(Ctx)]),
Ctx
View
16 src/ewgi_yaws.erl
@@ -56,12 +56,8 @@ run(Arg) ->
handle_result(Ctx) ->
{Code, _} = ewgi_api:response_status(Ctx),
- ContentType =
- case ewgi_api:content_type(Ctx) of
- undefined -> "text/plain";
- CT -> CT
- end,
H = ewgi_api:response_headers(Ctx),
+ ContentType = get_content_type(H),
Acc = get_yaws_headers(H),
case ewgi_api:response_message_body(Ctx) of
Generator when is_function(Generator, 0) ->
@@ -82,6 +78,16 @@ get_yaws_headers(H) ->
end
end, [], H).
+get_content_type(H) ->
+ lists:foldl(fun({K, V}, Def) ->
+ case string:to_lower(K) of
+ "content-type" ->
+ V;
+ _ ->
+ Def
+ end
+ end, "text/plain", H).
+
handle_stream(Generator, YawsPid) when is_function(Generator, 0) ->
case (catch Generator()) of
{H, T} when is_function(T, 0) ->
Please sign in to comment.
Something went wrong with that request. Please try again.