Skip to content

Commit

Permalink
Merge pull request openlayers#202 from probins/http
Browse files Browse the repository at this point in the history
ReadWithPOST should pass through options.headers (patch from @probins)
  • Loading branch information
Éric Lemoine committed Feb 7, 2012
2 parents 4b971a1 + 00a00db commit e7eae00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/OpenLayers/Protocol/HTTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
* {<OpenLayers.Protocol.Response>} A response object, whose "priv" property
* references the HTTP request, this object is also passed to the
* 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) {
OpenLayers.Protocol.prototype.read.apply(this, arguments);
Expand All @@ -183,13 +183,13 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
options.readWithPOST : this.readWithPOST;
var resp = new OpenLayers.Protocol.Response({requestType: "read"});
if(readWithPOST) {
var headers = options.headers || {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
resp.priv = OpenLayers.Request.POST({
url: options.url,
callback: this.createCallback(this.handleRead, resp, options),
data: OpenLayers.Util.getParameterString(options.params),
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
headers: headers
});
} else {
resp.priv = OpenLayers.Request.GET({
Expand Down

0 comments on commit e7eae00

Please sign in to comment.