Permalink
Browse files

Merge branch 'master' of github.com:tonyg/erlang-rfc4627

  • Loading branch information...
2 parents 7b93e5e + a5e7ad7 commit b1ddd26092e4e39d0474500947ff927a9ae60917 @tonyg committed Jun 8, 2012
Showing with 6 additions and 2 deletions.
  1. +3 −1 src/rfc4627_jsonrpc_inets.erl
  2. +3 −1 src/rfc4627_jsonrpc_mochiweb.erl
@@ -161,9 +161,11 @@ do_rpc(#mod{init_data = #init_data{peername = {PeerPort, PeerName}},
{ok, ResultEnc, ResponseInfo} ->
{obj, ResponseHeaderFields} =
rfc4627:get_field(ResponseInfo, "http_headers", {obj, []}),
+ StatusCode =
+ rfc4627:get_field(ResponseInfo, "http_status_code", 200),
Headers = [{K, binary_to_list(V)} || {K,V} <- ResponseHeaderFields],
{proceed, [{response, {response,
- [{code, 200},
+ [{code, StatusCode},
{content_length, integer_to_list(length(ResultEnc))},
{content_type, rfc4627:mime_type()}
| Headers],
@@ -110,6 +110,8 @@ handle(AliasPrefix, Req) ->
end,
{obj, ResponseHeaderFields} =
rfc4627:get_field(ResponseInfo, "http_headers", {obj, []}),
+ StatusCode =
+ rfc4627:get_field(ResponseInfo, "http_status_code", 200),
Headers = [{K, binary_to_list(V)} || {K,V} <- ResponseHeaderFields],
- {ok, {200, Headers ++ [{"Content-type", RespType}], ResultEnc}}
+ {ok, {StatusCode, Headers ++ [{"Content-type", RespType}], ResultEnc}}
end.

0 comments on commit b1ddd26

Please sign in to comment.