Create a WSGI application out of the given Minion app.

    Arguments:

        application (Application):

            a minion app

        request_class (callable):

            a class to use for constructing incoming requests out of the WSGI
            environment. It will be passed a single arg, the environ.

            By default, this is :class:`minion.request.WSGIRequest` if
            unprovided.

def create_app(application, request_class=Request):
    """
    Create a WSGI application out of the given Minion app.

    Arguments:

        application (Application):

            a minion app

        request_class (callable):

            a class to use for constructing incoming requests out of the WSGI
            environment. It will be passed a single arg, the environ.

            By default, this is :class:`minion.request.WSGIRequest` if
            unprovided.
    """

    def wsgi(environ, start_response):
        response = application.serve(
            request=request_class(environ),
            path=environ.get("PATH_INFO", ""),
        )
        start_response(
            response.status, [
                (name, b",".join(values))
                for name, values in response.headers.canonicalized()
            ],
        )
        return [response.content]
    return wsgi