%Rst = handle_req(Req#cowboy_req:req.qs%http_req.qs),
{ContentType,Rst} = handle_req(element(14,Req)),
Req2 = cowboy_req:reply(200, [
% {<<"content-type">>, <<"text/plain">>}
% {<<"content-type">>, <<"text/html; charset=utf-8">>}
ContentType
]
{ContentType,Rst} = handle_req(element(14,Req)),
Req2 = cowboy_req:reply(200, [
% {<<"content-type">>, <<"text/plain">>}
% {<<"content-type">>, <<"text/html; charset=utf-8">>}
ContentType
]
,Rst,Req),
{<<"content-type">>, <<"text/plain">>} 返回的是txt
{<<"content-type">>, <<"text/html; charset=utf-8">>} 返回的是html
Rst是返回的内容;如果返回的是跳转到特定URL(比如3秒后跳转到百度),Rst如下:
<<"<html><head><meta http-equiv=\"refresh\" content=\"3;url=http://www.baidu.com\"></head></html>">>