Skip to content

Commit

Permalink
dialyzed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Licenser committed Jul 31, 2013
1 parent b8aa991 commit e64eaa9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/wiggle/src/wiggle_rest_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,22 @@ resource_exists(Req, State = #state{module = M}) ->
{true, Req, State#state{obj = Obj}}
end.

-ifndef(old_hash).

generate_etag(Req, State = #state{obj = undefined}) ->
{undefined, Req, State};
generate_etag(Req, State = #state{obj = Obj}) ->
{{strong, base64:encode(crypto:hash(md5, term_to_binary(Obj)))}, Req, State}.

-else.

generate_etag(Req, State = #state{obj = undefined}) ->
{undefined, Req, State};
generate_etag(Req, State = #state{obj = Obj}) ->
{{strong, base64:encode(crypto:md5(term_to_binary(Obj)))}, Req, State}.

-endif.

is_authorized(Req, State = #state{method = <<"OPTIONS">>}) ->
{true, Req, State};

Expand Down
2 changes: 2 additions & 0 deletions dialyzer.mittigate
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
^mimetypes
^lhttpc
^newrelic.erl
^glc_code.erl:
^lager.erl
11 changes: 11 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
case erlang:system_info(otp_release) =< "R15B01" of
true ->
HashDefine = [{d,old_hash}],
case lists:keysearch(erl_opts, 1, CONFIG) of
{value, {erl_opts, Opts}} ->
lists:keyreplace(erl_opts,1,CONFIG,{erl_opts,Opts++HashDefine});
false ->
CONFIG ++ [{erl_opts, HashDefine}]
end;
false -> CONFIG
end.

0 comments on commit e64eaa9

Please sign in to comment.