Skip to content

Commit

Permalink
add options method to all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
amn41 committed Sep 14, 2017
1 parent cfd26fc commit 1dd0ca6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rasa_nlu/server.py
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

0 comments on commit 1dd0ca6

Please sign in to comment.