~fmartingr/openshift-sample-app

25ed8eb24c9e845ba43862dc8d76e878f896d323 — Felipe Martin 2 months ago 20c38c5
Fixed /log view responses
1 files changed, 7 insertions(+), 5 deletions(-)

M app.py
M app.py => app.py +7 -5
@@ 19,14 19,14 @@ def root_view():
                filter(None, app.view_functions[rule.endpoint].__doc__.split("\n"))
            )[0].strip()

    # JSON response
    if request.accept_mimetypes.accept_json:
        return jsonify(routes)

    # HTML response
    if request.accept_mimetypes.accept_html:
        return render_template("index.j2", routes=routes)

    # JSON response
    if request.accept_mimetypes.accept_json:
        return jsonify(routes)

    # Plain text response
    return Response(
        "\n".join(


@@ 86,13 86,15 @@ def log_view():
    Accepts JSON and plain text
    Returns the provided data on response
    """
    # JSON response
    if request.is_json:
        app.logger.warn(request.json)
        return jsonify(request.json)

    # Plain text response
    data = request.get_data().decode("utf-8")
    app.logger.warn(data)
    return Response(data)
    return Response(data, content_type="plain/text")


@app.route("/http_request", methods=["POST"])