pulling up fix for reopened ticket:2393 to 2.9 branch
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.9@10275 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -358,10 +358,11 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
* the feature received from the server.
|
||||
*/
|
||||
update: function(feature, options) {
|
||||
options = OpenLayers.Util.applyDefaults(options, this.options);
|
||||
options = options || {};
|
||||
var url = options.url ||
|
||||
feature.url ||
|
||||
this.options.url + "/" + feature.fid;
|
||||
options = OpenLayers.Util.applyDefaults(options, this.options);
|
||||
|
||||
var resp = new OpenLayers.Protocol.Response({
|
||||
reqFeatures: feature,
|
||||
@@ -408,10 +409,11 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
* completes.
|
||||
*/
|
||||
"delete": function(feature, options) {
|
||||
options = OpenLayers.Util.applyDefaults(options, this.options);
|
||||
options = options || {};
|
||||
var url = options.url ||
|
||||
feature.url ||
|
||||
this.options.url + "/" + feature.fid;
|
||||
options = OpenLayers.Util.applyDefaults(options, this.options);
|
||||
|
||||
var resp = new OpenLayers.Protocol.Response({
|
||||
reqFeatures: feature,
|
||||
|
||||
@@ -696,6 +696,34 @@
|
||||
OpenLayers.Request.PUT = _put;
|
||||
}
|
||||
|
||||
function test_update_featureurl(t) {
|
||||
|
||||
// test that OpenLayers.Request.PUT receives the URL
|
||||
// set in the feature
|
||||
// http://trac.openlayers.org/ticket/2393#comment:11
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var protocol = new OpenLayers.Protocol.HTTP({
|
||||
'url': 'foo_url',
|
||||
'format': {'write': function() {}}
|
||||
});
|
||||
|
||||
// feature to pass to update
|
||||
var feature = {'feature':'feature', 'url': 'bar_url'};
|
||||
|
||||
var _put = OpenLayers.Request.PUT;
|
||||
|
||||
OpenLayers.Request.PUT = function(options) {
|
||||
t.eq(options.url, feature.url,
|
||||
'PUT called with correct url in options');
|
||||
};
|
||||
|
||||
protocol.update(feature);
|
||||
|
||||
OpenLayers.Request.PUT = _put;
|
||||
}
|
||||
|
||||
function test_handleResponse(t) {
|
||||
t.plan(6);
|
||||
|
||||
@@ -817,6 +845,34 @@
|
||||
OpenLayers.Request.DELETE = _delete;
|
||||
}
|
||||
|
||||
function test_delete_featureurl(t) {
|
||||
|
||||
// test that OpenLayers.Request.DELETE receives the URL
|
||||
// set in the feature
|
||||
// http://trac.openlayers.org/ticket/2393#comment:11
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var protocol = new OpenLayers.Protocol.HTTP({
|
||||
'url': 'foo_url',
|
||||
'format': {'write': function() {}}
|
||||
});
|
||||
|
||||
// feature to pass to update
|
||||
var feature = {'feature':'feature', 'url': 'bar_url'};
|
||||
|
||||
var _delete = OpenLayers.Request.DELETE;
|
||||
|
||||
OpenLayers.Request.DELETE = function(options) {
|
||||
t.eq(options.url, feature.url,
|
||||
'DELETE called with correct url in options');
|
||||
};
|
||||
|
||||
protocol['delete'](feature);
|
||||
|
||||
OpenLayers.Request.DELETE = _delete;
|
||||
}
|
||||
|
||||
function test_handleDelete(t) {
|
||||
t.plan(4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user