Skip to content

Commit

Permalink
Change from GET to POST to fix 414 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanchewy committed Sep 21, 2018
1 parent 3e5c7f3 commit a11cb93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def index():
session["time_now"] = datetime.now()
return render_template("index.html")

@app.route('/check_code')
@app.route('/check_code', methods=['POST'])
def check_code():
"""Run pylint on code and get output
:return: JSON object of pylint errors
Expand All @@ -53,7 +53,7 @@ def check_code():
https://github.com/PyCQA/pylint/blob/master/pylint/lint.py
"""
#Get textarea text from AJAX call
text = request.args.get('text')
text = request.form['text']

# Session to handle multiple users at one time
session["code"] = text
Expand Down
3 changes: 1 addition & 2 deletions static/js/cm-validator-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CodeMirror.remoteValidator = function(cm, updateLinting, options) {
{
var found = [];

console.log(error_list);
for(var i in error_list)
{
var error = error_list[i];
Expand Down Expand Up @@ -53,7 +52,7 @@ CodeMirror.remoteValidator = function(cm, updateLinting, options) {
});
}
}

updateLinting(cm, found);
}

Expand Down
6 changes: 3 additions & 3 deletions static/js/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $(document).ready(function(){

}
//AJAX call to pylint
$.getJSON('/check_code', {
$.post('/check_code', {
text : code
}, function(data) {
current_text = data;
Expand Down Expand Up @@ -114,7 +114,7 @@ $(document).ready(function(){

//Actually Run in Python
$( "#run" ).click(function() {
$.getJSON('/run_code', {
$.post('/run_code', {
text : editor.getValue()
}, function(data) {
print_result(data);
Expand All @@ -125,7 +125,7 @@ $(document).ready(function(){
document.getElementById('output').innerHTML = '';
$("#output").append("<pre>"+data+"</pre>");
}
});
}, "json");
var exampleCode = function (id, text) {
$(id).click(function (e) {
editor.setValue(text);
Expand Down

0 comments on commit a11cb93

Please sign in to comment.