<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [99s-extend] populating #http_req for unit testing
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20populating%20%23http_req%20for%20unit%20testing&In-Reply-To=%3CCD8CCDCD.A1C9%25kevin.brown%40turner.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000105.html">
<LINK REL="Next" HREF="000107.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[99s-extend] populating #http_req for unit testing</H1>
<B>Brown, Kevin</B>
<A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20populating%20%23http_req%20for%20unit%20testing&In-Reply-To=%3CCD8CCDCD.A1C9%25kevin.brown%40turner.com%3E"
TITLE="[99s-extend] populating #http_req for unit testing">Kevin.Brown at turner.com
</A><BR>
<I>Fri Apr 12 02:30:15 CEST 2013</I>
<P><UL>
<LI>Previous message: <A HREF="000105.html">[99s-extend] populating #http_req for unit testing
</A></li>
<LI>Next message: <A HREF="000107.html">[99s-extend] populating #http_req for unit testing
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#106">[ date ]</a>
<a href="thread.html#106">[ thread ]</a>
<a href="subject.html#106">[ subject ]</a>
<a href="author.html#106">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Thanks.
On 4/11/13 8:07 PM, "Loïc Hoguin" <<A HREF="https://lists.ninenines.eu/listinfo/extend">essen at ninenines.eu</A>> wrote:
><i>There's a few undocumented functions in cowboy_req, like new, set and
</I>><i>get, used by Cowboy internally.
</I>><i>
</I>><i>On 04/12/2013 01:37 AM, Brown, Kevin wrote:
</I>>><i>
</I>>><i> Cowfolk,
</I>>><i>
</I>>><i> I am doing something like this to create an #http_req suitable for unit
</I>>><i> testing my resource callbacks:
</I>>><i>
</I>>><i> -define (HTTP_REQ_ENCODERS_PORT_8000, #http_req{host=
</I>>><i><<"www.foo.com">> ,
</I>>><i> port=8000, path= <<"/encoders">>,transport=ranch_tcp, qs= <<>>,
</I>>><i>fragment=
</I>>><i> <<>> }).
</I>>><i>
</I>>><i> Notice that I needed to set the transport to a Cowboy specific atom
</I>>><i> because I wanted to get cowboy_req:host_url and cowboy_req:path to work
</I>>><i> properly.
</I>>><i>
</I>>><i> I'm sure there is a method that Cowboy uses internally to populate an
</I>>><i> #http_req from a URL that I could use for testing. What might that be?
</I>>><i> How else should I be populating this record.
</I>>><i>
</I>>><i> Cheers,
</I>>><i>
</I>>><i> -kb
</I>>><i>
</I>>><i>
</I>>><i>
</I>>><i>
</I>>><i>
</I>>><i>
</I>>><i> On 4/11/13 7:07 PM, "<A HREF="https://lists.ninenines.eu/listinfo/extend">extend-request at lists.ninenines.eu</A>"
</I>>><i> <<A HREF="https://lists.ninenines.eu/listinfo/extend">extend-request at lists.ninenines.eu</A>> wrote:
</I>>><i>
</I>>>><i> Welcome to the <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> mailing list!
</I>>>><i>
</I>>>><i> To post to this list, send your message to:
</I>>>><i>
</I>>>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">extend at lists.ninenines.eu</A>
</I>>>><i>
</I>>>><i> General information about the mailing list is at:
</I>>>><i>
</I>>>><i> <A HREF="http://lists.ninenines.eu:81/listinfo/extend">http://lists.ninenines.eu:81/listinfo/extend</A>
</I>>>><i>
</I>>>><i> If you ever want to unsubscribe or change your options (eg, switch to
</I>>>><i> or from digest mode, change your password, etc.), visit your
</I>>>><i> subscription page at:
</I>>>><i>
</I>>>><i> <A HREF="http://lists.ninenines.eu:81/options/extend/kevin.brown%40turner.com">http://lists.ninenines.eu:81/options/extend/kevin.brown%40turner.com</A>
</I>>>><i>
</I>>>><i> You can also make such adjustments via email by sending a message to:
</I>>>><i>
</I>>>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend-request at lists.ninenines.eu</A>
</I>>>><i>
</I>>>><i> with the word `help' in the subject or body (don't include the
</I>>>><i> quotes), and you will get back a message with instructions.
</I>>>><i>
</I>>>><i> You must know your password to change your options (including changing
</I>>>><i> the password, itself) or to unsubscribe without confirmation. It is:
</I>>>><i>
</I>>>><i> doofus1
</I>>>><i>
</I>>>><i> Normally, Mailman will remind you of your lists.ninenines.eu mailing
</I>>>><i> list passwords once every month, although you can disable this if you
</I>>>><i> prefer. This reminder will also include instructions on how to
</I>>>><i> unsubscribe or change your account options. There is also a button on
</I>>>><i> your options page that will email your current password to you.
</I>>>><i>
</I>>><i>
</I>>><i>
</I>>><i> _______________________________________________
</I>>><i> Extend mailing list
</I>>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>>><i> <A HREF="http://lists.ninenines.eu:81/listinfo/extend">http://lists.ninenines.eu:81/listinfo/extend</A>
</I>>><i>
</I>><i>
</I>><i>
</I>><i>--
</I>><i>Loïc Hoguin
</I>><i>Erlang Cowboy
</I>><i>Nine Nines
</I>><i><A HREF="http://ninenines.eu">http://ninenines.eu</A>
</I>><i>
</I>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000105.html">[99s-extend] populating #http_req for unit testing
</A></li>
<LI>Next message: <A HREF="000107.html">[99s-extend] populating #http_req for unit testing
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#106">[ date ]</a>
<a href="thread.html#106">[ thread ]</a>
<a href="subject.html#106">[ subject ]</a>
<a href="author.html#106">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>