Skip to content

Flask server - Method not allowed #10

Description

@vladko312

Currently, your Flask server supports only GET request (default), so testing results are not reflecting header processing quirks.

To enable other methods, @app.route decorators could be replaced by direct route adding:

import sys
from flask import Flask
from werkzeug.routing import Rule

app = Flask(__name__)

app.url_map.add(Rule('/', defaults={"path": ""}, endpoint='catch_all'))
app.url_map.add(Rule('/<path:path>', endpoint='catch_all'))

@app.endpoint('catch_all')
def catch_all(path):
    return "OK"

if __name__ == "__main__":
    port = int(sys.argv[1]) if len(sys.argv) > 1 else 9002
    app.run(host="0.0.0.0", port=port)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions