Skip to content

Commit

Permalink
Fix rest_cherrypy CORS OPTIONS request on Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
niflostancu committed Dec 6, 2019
1 parent ea2feb5 commit 213b1ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions salt/netapi/rest_cherrypy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,11 @@ def cors_tool():
resp_head['Connection'] = 'keep-alive'
resp_head['Access-Control-Max-Age'] = '1400'

# CORS requests should short-circuit the other tools.
cherrypy.response.body = ''
# Note: CherryPy on Py3 uses binary objects for the response
# Python 2.6 also supports the byte prefix, so no need for conditionals
cherrypy.response.body = b''
cherrypy.response.status = 200
# CORS requests should short-circuit the other tools.
cherrypy.serving.request.handler = None

# Needed to avoid the auth_tool check.
Expand Down

0 comments on commit 213b1ea

Please sign in to comment.