[OpenLayers-Dev] Sending the "X-Requested-With" header in AJAX calls

Marc Jansen jansen at terrestris.de
Thu Sep 8 04:30:04 EDT 2011


Hi all,

Here is the ticket for the "X-Requested-With" in AJAX calls:
http://trac.osgeo.org/openlayers/ticket/3491 which changes
OpenLayers/Request.js but in a different manner (see e.g.
http://trac.osgeo.org/openlayers/ticket/3491#comment:1 or the code
comments for clarification on why).

Thanks for your feedback so far.

Best regards,
Marc



On 08.09.2011 06:24, Eric Lemoine wrote:
>
>
> On Wednesday, September 7, 2011, Xavier Mamano (jorix)
> <xavier.mamano at gmail.com <mailto:xavier.mamano at gmail.com>> wrote:
> > Hi,
> >
> > Great!
> >
> > But "Request.XMLHttpRequest" is not written by OpenLayers Team (see
> license
> > in XMLHttpRequest.js) and is fully wrapped by "Request", so I think best
> > make the following change:
> >
> > Index: lib/OpenLayers/Request.js
> > ===================================================================
> > --- lib/OpenLayers/Request.js   (revision 12340)
> > +++ lib/OpenLayers/Request.js   (working copy)
> > @@ -122,6 +122,10 @@
> >             {proxy: OpenLayers.ProxyHost}
> >         );
> >         config = OpenLayers.Util.applyDefaults(config, defaultConfig);
> > +        config.headers = OpenLayers.Util.applyDefaults(
> > +            config.headers,
> > +            {"X-Requested-With": "XMLHttpRequest"}
> > +        );
> >
> >         // create request, open, and set headers
> >         var request = new OpenLayers.Request.XMLHttpRequest();
> >
> > This has the same effect as your proposal.
>
>
> Indeed. Good catch.
>
> -- 
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com <mailto:eric.lemoine at camptocamp.com>
> http://www.camptocamp.com
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110908/939d0cc0/attachment.html


More information about the Dev mailing list