Skip to content

public interface for regression tests? #136

@clarkevans

Description

@clarkevans

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions