0 Replies Latest reply on Sep 13, 2012 9:45 AM by jdmwhitey1979

    Flash Sending POST request as GET request

    jdmwhitey1979

      I am sending a request to my server application using a POST request. I have verified that I am sending a request form body, yet somehow, randomly, the request will come through as a GET request instead of a post.

      This is troublesom because it means that my request has basically been truncated by flex/flash?

       

      Flex SDK 4.5

      Flash Player 11.3

       

      Code sample to ensure adding data to the request.
      Ex 1:

      public static function flushBatch():void {               

           if (_pendingBatch==null || _pendingBatch.length==0 || _processingBatch!=null) {

                 return;               

           }                

           _processingBatch = _pendingBatch;               

           _pendingBatch = null;               

           var request:URLRequest = new URLRequest(servletUrl + "batch");               

           request.method = URLRequestMethod.POST;               

           var data:ByteArray = new ByteArray();               

           for each (var r:ServiceRequest in _processingBatch) {                    

                data.writeUTF(r.url);               

           }

            if(data.length==0){                    

                _processingBatch=null;                    

                return;               

           }               

           request.data = data;               

           _batchLoader = new URLLoader();               

           _batchLoader.dataFormat = URLLoaderDataFormat.BINARY;               

           _batchLoader.addEventListener(Event.COMPLETE,batchComplete);               

           _batchLoader.addEventListener(IOErrorEvent.IO_ERROR,batchError);               

           _batchLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS,checkStatus);                

           _batchLoader.load(request);               

           _batchSendTime = getTimer();          

      }

      Example 2

      public static function flush():void {               

           if (_buffer!=null && _buffer.length>0) {                    

                Service.post("log",_buffer,null);                    

                _buffer = null;               

                }          

      }

       

      So just to be clear. The behavior is not consistent. It doesn't ALWAYS send GET instead of POST, but it does sometimes. And looking at this code, it appears to me that that should NEVER happen.