Send X-Error-Format workaround on OAuth PUT too
[potlatch2.git] / net / systemeD / halcyon / connection / XMLConnection.as
index ef94394..a76f5ff 100644 (file)
@@ -28,6 +28,15 @@ package net.systemeD.halcyon.connection {
                
                override public function loadBbox(left:Number,right:Number,
                                                                top:Number,bottom:Number):void {
+            purgeIfFull(left,right,top,bottom);
+            if (isBboxLoaded(left,right,top,bottom)) return;
+
+            // enlarge bbox by 20% on each edge
+            var xmargin:Number=(right-left)/5;
+            var ymargin:Number=(top-bottom)/5;
+            left-=xmargin; right+=xmargin;
+            bottom-=ymargin; top+=ymargin;
+
             var mapVars:URLVariables = new URLVariables();
             mapVars.bbox= left+","+bottom+","+right+","+top;
 
@@ -170,7 +179,8 @@ package net.systemeD.halcyon.connection {
             urlReq.method = "POST";
                        if (xml) { urlReq.data = xml.toXMLString(); } else { urlReq.data = true; }
             urlReq.contentType = "application/xml";
-            urlReq.requestHeaders = new Array(new URLRequestHeader("X_HTTP_METHOD_OVERRIDE", "PUT"));
+            urlReq.requestHeaders = [ new URLRequestHeader("X_HTTP_METHOD_OVERRIDE", "PUT"), 
+                                                 new URLRequestHeader("X-Error-Format", "XML") ];
             var loader:URLLoader = new URLLoader();
             loader.addEventListener(Event.COMPLETE, onComplete);
             loader.addEventListener(IOErrorEvent.IO_ERROR, onError);