Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Commit

Permalink
Added a check for a POST which might have empty parameters.
Browse files Browse the repository at this point in the history
git-svn-id: http://foursquare-as3.googlecode.com/svn/trunk@6 21ca1160-ee47-11de-9b30-9f9d59cce923
  • Loading branch information
twalling committed Dec 22, 2009
1 parent 432ea5c commit 0e27866
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -110,6 +110,7 @@ package com.timwalling.foursquare
var request:URLRequest = new URLRequest(url);
request.method = method;

var isVarsEmpty:Boolean = true;
var vars:URLVariables;
if (params)
{
Expand All @@ -118,12 +119,23 @@ package com.timwalling.foursquare
{
if (params[prop] != "" && params[prop] != null)
{
isVarsEmpty = false;
vars[prop] = params[prop];
}
}
request.data = vars;
}

// this is used to ensure that the request method remains
// a POST, if there are no variables to post then Flash
// automatically changes the request to a GET
if (request.method == URLRequestMethod.POST && isVarsEmpty)
{
vars = new URLVariables();
vars.dummy = "";
request.data = vars;
}

_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE, handleLoaderComplete);
_loader.addEventListener(IOErrorEvent.IO_ERROR, handleLoaderError);
Expand Down

0 comments on commit 0e27866

Please sign in to comment.