Commit d97cbe76 authored by Thomas Lechauve's avatar Thomas Lechauve

Cross-domain tests added

This tests are usefull to check if a browser support or not cross-domain
requests
parent 4d098c6b
......@@ -6,9 +6,16 @@ app = Flask(__name__)
def index():
return render_template("slapos.html")
@app.route('/200', methods=["POST", "GET"])
def request200():
response = make_response("HELLO", 200)
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = '*'
return response
@app.route('/request', methods=["POST", "GET"])
def request():
response = make_response("HELLO", 408)
def request404():
response = make_response("Not Found", 404)
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = '*'
return response
......
......@@ -42,12 +42,15 @@
request: function(type, url, callback, data){
data = data || '';
$.ajax({
url: this.config.host+url,
return $.ajax({
url: this.store('host')+url,
dataType: 'json',
data: data,
context: this.$elem,
type: type,
statusCode: {
0: function(){ console.log('status code 0') }
}
}).done(callback).fail(this.failCallback);
},
......@@ -56,7 +59,7 @@
},
newInstance: function(data, callback){
this.request('POST', '/request', callback, data);
return this.request('POST', '/request', callback, data);
},
deleteInstance: function(id, callback){
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment