Merge pull request #202 from probins/http
ReadWithPOST should pass through options.headers (patch from @probins)
This commit is contained in:
@@ -166,7 +166,7 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
|||||||
* {<OpenLayers.Protocol.Response>} A response object, whose "priv" property
|
* {<OpenLayers.Protocol.Response>} A response object, whose "priv" property
|
||||||
* references the HTTP request, this object is also passed to the
|
* references the HTTP request, this object is also passed to the
|
||||||
* callback function when the request completes, its "features" property
|
* callback function when the request completes, its "features" property
|
||||||
* is then populated with the the features received from the server.
|
* is then populated with the features received from the server.
|
||||||
*/
|
*/
|
||||||
read: function(options) {
|
read: function(options) {
|
||||||
OpenLayers.Protocol.prototype.read.apply(this, arguments);
|
OpenLayers.Protocol.prototype.read.apply(this, arguments);
|
||||||
@@ -183,13 +183,13 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
|||||||
options.readWithPOST : this.readWithPOST;
|
options.readWithPOST : this.readWithPOST;
|
||||||
var resp = new OpenLayers.Protocol.Response({requestType: "read"});
|
var resp = new OpenLayers.Protocol.Response({requestType: "read"});
|
||||||
if(readWithPOST) {
|
if(readWithPOST) {
|
||||||
|
var headers = options.headers || {};
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
||||||
resp.priv = OpenLayers.Request.POST({
|
resp.priv = OpenLayers.Request.POST({
|
||||||
url: options.url,
|
url: options.url,
|
||||||
callback: this.createCallback(this.handleRead, resp, options),
|
callback: this.createCallback(this.handleRead, resp, options),
|
||||||
data: OpenLayers.Util.getParameterString(options.params),
|
data: OpenLayers.Util.getParameterString(options.params),
|
||||||
headers: {
|
headers: headers
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resp.priv = OpenLayers.Request.GET({
|
resp.priv = OpenLayers.Request.GET({
|
||||||
|
|||||||
Reference in New Issue
Block a user