[99s-extend] populating #http_req for unit testing

Loïc Hoguin essen at ninenines.eu
Fri Apr 12 02:07:26 CEST 2013


There's a few undocumented functions in cowboy_req, like new, set and 
get, used by Cowboy internally.

On 04/12/2013 01:37 AM, Brown, Kevin wrote:
>
> Cowfolk,
>
> I am doing something like this to create an #http_req suitable for unit
> testing my resource callbacks:
>
> -define (HTTP_REQ_ENCODERS_PORT_8000,  #http_req{host= <<"www.foo.com">> ,
> port=8000, path= <<"/encoders">>,transport=ranch_tcp, qs= <<>>, fragment=
> <<>> }).
>
> Notice that I needed to set the transport to a Cowboy specific atom
> because I wanted to get cowboy_req:host_url and cowboy_req:path to work
> properly.
>
> I'm sure there is a method that Cowboy uses internally to populate an
> #http_req from a URL that I could use for testing.  What might that be?
> How else should I be populating this record.
>
> Cheers,
>
> -kb
>
>
>
>
>
>
> On 4/11/13 7:07 PM, "extend-request at lists.ninenines.eu"
> <extend-request at lists.ninenines.eu> wrote:
>
>> Welcome to the Extend at lists.ninenines.eu mailing list!
>>
>> To post to this list, send your message to:
>>
>>   extend at lists.ninenines.eu
>>
>> General information about the mailing list is at:
>>
>>   http://lists.ninenines.eu:81/listinfo/extend
>>
>> If you ever want to unsubscribe or change your options (eg, switch to
>> or from digest mode, change your password, etc.), visit your
>> subscription page at:
>>
>>   http://lists.ninenines.eu:81/options/extend/kevin.brown%40turner.com
>>
>> You can also make such adjustments via email by sending a message to:
>>
>>   Extend-request at lists.ninenines.eu
>>
>> with the word `help' in the subject or body (don't include the
>> quotes), and you will get back a message with instructions.
>>
>> You must know your password to change your options (including changing
>> the password, itself) or to unsubscribe without confirmation.  It is:
>>
>>   doofus1
>>
>> Normally, Mailman will remind you of your lists.ninenines.eu mailing
>> list passwords once every month, although you can disable this if you
>> prefer.  This reminder will also include instructions on how to
>> unsubscribe or change your account options.  There is also a button on
>> your options page that will email your current password to you.
>>
>
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> http://lists.ninenines.eu:81/listinfo/extend
>


-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the Extend mailing list