Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add options method to all routes #592

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rasa_nlu/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def __init__(self, config, component_builder=None, testing=False):
def _create_data_router(self, config, component_builder):
return DataRouter(config, component_builder)

@app.route("/", methods=['GET'])
@app.route("/", methods=['GET', 'OPTIONS'])
@check_cors
def hello(self, request):
"""Main Rasa route to check if the server is online"""
return "hello from Rasa NLU: " + __version__

@app.route("/parse", methods=['GET', 'POST'])
@app.route("/parse", methods=['GET', 'POST', 'OPTIONS'])
@requires_auth
@check_cors
@inlineCallbacks
Expand Down Expand Up @@ -140,7 +140,7 @@ def parse_get(self, request):
request.setResponseCode(500)
returnValue(json.dumps({"error": "{}".format(e)}))

@app.route("/version", methods=['GET'])
@app.route("/version", methods=['GET', 'OPTIONS'])
@requires_auth
@check_cors
def version(self, request):
Expand All @@ -149,7 +149,7 @@ def version(self, request):
request.setHeader('Content-Type', 'application/json')
return json.dumps({'version': __version__})

@app.route("/config", methods=['GET'])
@app.route("/config", methods=['GET', 'OPTIONS'])
@requires_auth
@check_cors
def rasaconfig(self, request):
Expand All @@ -158,14 +158,14 @@ def rasaconfig(self, request):
request.setHeader('Content-Type', 'application/json')
return json.dumps(self.config.as_dict())

@app.route("/status", methods=['GET'])
@app.route("/status", methods=['GET', 'OPTIONS'])
@requires_auth
@check_cors
def status(self, request):
request.setHeader('Content-Type', 'application/json')
return json.dumps(self.data_router.get_status())

@app.route("/train", methods=['POST'])
@app.route("/train", methods=['POST', 'OPTIONS'])
@requires_auth
@check_cors
@inlineCallbacks
Expand Down