Thanks to Slava Yurin<div><br></div><div>His  advise:</div><div> <div>make_post(Req, State) -></div><div>    ...,</div><div>    {ok, Reply} = cowboy_req:reply(201, [], <<"HELLO POST\n">>, Req),</div><div>    {halt, Reply, State}.</div><div><br></div><br>On Tuesday, June 11, 2013 9:17:41 PM UTC+3, Max Grigoriev wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
How can I set status code in my REST POST handler.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
Now I'm doing this</p><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:14px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;color:rgb(0,0,0);line-height:18px"><code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif">make_post(Req, State) ->
  lager:info("post"),
  Resp = cowboy_req:set_resp_body(<<"<wbr>HELLO POST\n">>, Req),
  {ok, Resp3} = cowboy_req:reply(201, Resp),
  {true, Resp3, State}.
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
But I receive such errors:</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
1:43:10.510 [info] [nonode@nohost#pbshare_logic_<wbr>registration#<0.205.0>] [handle_info#35] :Exit Logic from <0.204.0> Reason: {function_clause,[{cowboy_req,<wbr>reply,[204,[],<<>>,{http_req,#<wbr>Port<0.6355>,ranch_tcp,<wbr>keepalive,<0.204.0>,<<"POST">><wbr>,'HTTP/1.1',{{127,0,0,1},<wbr>50024},<<"localhost">>,<wbr>undefined,8080,<<"/rest/<wbr>registration/make">>,[<<"make"<wbr>>>],<<>>,undefined,[],[{<<"<wbr>user-agent">>,<<"curl/7.29.0"><wbr>>},{<<"host">>,<<"localhost:<wbr>8080">>},{<<"accept">>,<<"<em style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">/</em>">><wbr>},{<<"content-type">>,<<"<wbr>application/json">>},{<<"<wbr>content-length">>,<<"14">>}],[<wbr>{<<"content-length">>,14},{<<"<wbr>expect">>,undefined},{<<"<wbr>content-length">>,14},{<<"<wbr>content-type">>,{<<"<wbr>application">>,<<"json">>,[]}}<wbr>,{<<"if-modified-since">>,<wbr>undefined},{<<"if-none-match"><wbr>>,undefined},{<<"if-<wbr>unmodified-since">>,undefined}<wbr>,{<<"if-match">>,undefined},{<<wbr><"accept">>,[{{<<"<em style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">">>,<<"</em>">>,[<wbr>]},1000,[]}]}],undefined,[{<wbr>charset,undefined},{media_<wbr>type,{<<"application">>,<<"<wbr>json">>,[]}}],done,undefined,<<wbr><>>,false,done,[],<<>>,<wbr>undefined}],[{file,"src/<wbr>cowboy_req.erl"},{line,948}]},<wbr>{cowboy_rest,respond,3,[{file,<wbr>"src/cowboy_rest.erl"},{line,<wbr>1085}]},{cowboy_rest,upgrade,<wbr>4,[{file,"src/cowboy_rest.erl"<wbr>},{line,75}]},{cowboy_<wbr>protocol,execute,4,[{file,"<wbr>src/cowboy_protocol.erl"},{<wbr>line,523}]}]} 21:43:10.510 [error] [Undefined#Undefined#emulator] [Undefined#Undefined] :Error in process <0.204.0> with exit value: {function_clause,[{cowboy_req,<wbr>reply,[204,[],<<0 bytes>>,{http_req,#Port<0.<wbr>6355>,ranch_tcp,keepalive,<0.<wbr>204.0>,<<4 bytes>>,'HTTP/1.1',{{127,0,0,<wbr>1},50024},<<9 bytes>>,undefined,8080,<<23 bytes>>,[<<4 bytes>>],<<0 bytes>>,undefined,[],[{<<10 bytes>>,<<11 bytes>>},{<<4 bytes>>,<<14 bytes>>},{<<6 bytes>>,<<3 bytes>>},{<<12 bytes>>,<<16 bytes>>},{<<14 bytes>>,<<2 bytes>>}],[{<<14 bytes>>,14},{<<6 bytes>>,undefined},{<<14 bytes>>,14},{<<12 bytes>>,{<<11 bytes>>,<<4 bytes>>,[]}},{<<17 bytes>>,undefined},{<<13 bytes>>,undefined},{<<19 bytes>>,undefined},{<<8 bytes>>,undefined...</p>
</div>
</blockquote></div>