I want to send a html script to a python Flask route. It can be content of an html page (with tags and text content).
Here is the javascript portion:
var xhr = new XMLHttpRequest();
var url = "http://localhost:5000/todo/api/v1.0/process/" + htmlstring;
xhr.open('GET', url, false);
xhr.send();
var retrievedtext = xhr.responseText; //This will be returned by Flask
The flask portion of the code is:
@app.route('/todo/api/v1.0/clean/<source_code>', methods=['GET'])
def process_html_code(source_code):
//do processing
return result
However, I always get 404 error when sending html as it is not allowed. What is a good approach to be able to send html to flask?