Complete the GET handler. It would return some wrong codes before.
parent
f1ad05f789
commit
33cc07914d
|
@ -26,7 +26,8 @@ else is considered a bad request, apart from the obvious case of 500
|
|||
|
||||
-export([init/2, terminate/3, allowed_methods/2,
|
||||
content_types_provided/2, known_methods/2,
|
||||
resource_exists/2, send_body/2]).
|
||||
resource_exists/2, previously_existed/2,
|
||||
moved_permanently/2, send_body/2]).
|
||||
|
||||
-include_lib("storage/include/storage.hrl").
|
||||
|
||||
|
@ -41,7 +42,7 @@ allowed_methods(Req, State) ->
|
|||
{[<<"GET">>], Req, State}.
|
||||
|
||||
content_types_provided(Req, State) ->
|
||||
{[{{'_', '*'}, send_body}], Req, State}.
|
||||
{[{<<"*/*">>, send_body}], Req, State}.
|
||||
|
||||
known_methods(Req, State) ->
|
||||
{[<<"GET">>], Req, State}.
|
||||
|
@ -55,6 +56,12 @@ resource_exists(Req, State) ->
|
|||
_ -> {false, Req, []}
|
||||
end.
|
||||
|
||||
previously_existed(Req, _State) ->
|
||||
{false, Req, []}.
|
||||
|
||||
moved_permanently(Req, State) ->
|
||||
{false, Req, State}.
|
||||
|
||||
send_body(Req, Record) ->
|
||||
{Record#object.value, Req, '_'}.
|
||||
|
||||
|
|
Loading…
Reference in New Issue