Currently, Mux doesn't export http_handler in its public interface, yet, something like it is required to build regression tests that don't open a socket. Indeed, opening a socket isn't really required to test Mux... you just send a Request and get a Response object. Here is a rough stab at a trivial wrapper to make get and post requests where one could type get("/") to print the given response to stdout.
@app APP = ...
loopback(req::Request) =
read(IOBuffer(HTTP.handle(Mux.http_handler(APP), req).body), String)
wget(url) = println(loopback(HTTP.Request("GET", url)))
post(url) = println(loopback(HTTP.Request("POST", url)))
Something similar might be nice to include so that application developers could test their interfaces w/o having a webserver active. Generally, we might wish to also consider updating regression tests in this project to use a similar method. There's no real need to test most of the functionality via sockets. At this level in the stack what's matter is functionality via Request/Response.
Currently,
Muxdoesn't exporthttp_handlerin its public interface, yet, something like it is required to build regression tests that don't open a socket. Indeed, opening a socket isn't really required to test Mux... you just send a Request and get a Response object. Here is a rough stab at a trivial wrapper to makegetandpostrequests where one could typeget("/")to print the given response to stdout.Something similar might be nice to include so that application developers could test their interfaces w/o having a webserver active. Generally, we might wish to also consider updating regression tests in this project to use a similar method. There's no real need to test most of the functionality via sockets. At this level in the stack what's matter is functionality via Request/Response.