I'm trying to push an entire line of text like - Hi, What's up? to a Flask REST API through curl via - curl -X POST "http://localhost:5000/predict/Hi, whats up". 
The issue I have with is when the string being passed is with spaces (special characters) i.e  curl -X POST "http://localhost:5000/data/Hiwhatsup" works fine but the earlier one throws a bad request. Can anyone explain why this happens? Or how to circumvent it?
The code I'm using is as follows:
@app.route("/data/<string:query>", methods=["POST"])
def data(query):
    incoming = query
    print(incoming)
 
     
    