WFS protocol commit: send HTTP headers. p=arneke,me r=me (closes #3204)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11880 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -203,7 +203,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
|||||||
params: options.params,
|
params: options.params,
|
||||||
headers: options.headers,
|
headers: options.headers,
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
@@ -316,6 +316,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
|||||||
});
|
});
|
||||||
response.priv = OpenLayers.Request.POST({
|
response.priv = OpenLayers.Request.POST({
|
||||||
url: options.url,
|
url: options.url,
|
||||||
|
headers: options.headers,
|
||||||
data: this.format.write(features, options),
|
data: this.format.write(features, options),
|
||||||
callback: this.createCallback(this.handleCommit, response, options)
|
callback: this.createCallback(this.handleCommit, response, options)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_commit(t){
|
function test_commit(t){
|
||||||
t.plan(4);
|
t.plan(5);
|
||||||
|
|
||||||
var url = "http://some.url.org";
|
var url = "http://some.url.org";
|
||||||
var protocol = new OpenLayers.Protocol.WFS({
|
var protocol = new OpenLayers.Protocol.WFS({
|
||||||
@@ -127,6 +127,7 @@
|
|||||||
var expected;
|
var expected;
|
||||||
OpenLayers.Request.POST = function(obj) {
|
OpenLayers.Request.POST = function(obj) {
|
||||||
t.xml_eq(new OpenLayers.Format.XML().read(obj.data).documentElement, expected, "Transaction XML with Insert, Update and Delete created correctly");
|
t.xml_eq(new OpenLayers.Format.XML().read(obj.data).documentElement, expected, "Transaction XML with Insert, Update and Delete created correctly");
|
||||||
|
t.eq(obj.headers, {foo: 'bar'}, "HTTP headers passed from commit to Request.POST");
|
||||||
obj.responseText = "foo";
|
obj.responseText = "foo";
|
||||||
t.delay_call(0.1, function() {obj.callback.call(this)});
|
t.delay_call(0.1, function() {obj.callback.call(this)});
|
||||||
return obj;
|
return obj;
|
||||||
@@ -151,6 +152,7 @@
|
|||||||
options = {
|
options = {
|
||||||
featureNS: "http://some.namespace.org",
|
featureNS: "http://some.namespace.org",
|
||||||
featureType: "type",
|
featureType: "type",
|
||||||
|
headers: {foo: 'bar'},
|
||||||
callback: function(response) {
|
callback: function(response) {
|
||||||
t.eq(response.insertIds.length, 3, "correct response passed to user callback");
|
t.eq(response.insertIds.length, 3, "correct response passed to user callback");
|
||||||
t.eq(response.code, OpenLayers.Protocol.Response.SUCCESS, "success properly reported to user callback");
|
t.eq(response.code, OpenLayers.Protocol.Response.SUCCESS, "success properly reported to user callback");
|
||||||
|
|||||||
Reference in New Issue
Block a user