2013-08-25 02:13:53 +09:00
|
|
|
%% Feel free to use, reuse and abuse the code in this file.
|
|
|
|
|
2014-09-26 15:58:44 +03:00
|
|
|
%% @todo That module was clearly meant to do more than one
|
|
|
|
%% thing and yet doesn't.
|
2013-08-25 02:13:53 +09:00
|
|
|
-module(http_req_attr).
|
|
|
|
|
2014-09-26 15:58:44 +03:00
|
|
|
-export([init/2]).
|
|
|
|
|
|
|
|
init(Req, Opts) ->
|
|
|
|
#{attr := Attr} = cowboy_req:match_qs(Req, [attr]),
|
|
|
|
<<"host_and_port">> = Attr,
|
2014-09-23 16:43:29 +03:00
|
|
|
Host = cowboy_req:host(Req),
|
|
|
|
Port = cowboy_req:port(Req),
|
2013-08-25 02:13:53 +09:00
|
|
|
Value = [Host, "\n", integer_to_list(Port)],
|
2014-09-30 20:12:13 +03:00
|
|
|
{ok, cowboy_req:reply(200, [], Value, Req), Opts}.
|