Skip to content

Commit

Permalink
update api content-type check
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Feb 10, 2025
1 parent 8a3e0c6 commit a60099a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _get_src_ip() -> str:
# curl -XPOST https://risk.oxl.app/api/report --data '{"ip": "1.1.1.1", "cat": "bot"}' -H 'Content-Type: application/json'
@app.route('/api/report', methods=['POST'])
def report() -> Response:
if 'Content-Type' not in request.headers or request.headers['Content-Type'] != 'application/json':
if 'Content-Type' not in request.headers or not request.headers['Content-Type'].startswith('application/json'):
return _response_json(code=400, data={'msg': 'Expected JSON'})

data = request.get_json()
Expand Down

0 comments on commit a60099a

Please sign in to comment.