From 0e27866812fc6ed3aa8115d84e36ec723fbc6871 Mon Sep 17 00:00:00 2001 From: twalling Date: Tue, 22 Dec 2009 21:25:40 +0000 Subject: [PATCH] Added a check for a POST which might have empty parameters. git-svn-id: http://foursquare-as3.googlecode.com/svn/trunk@6 21ca1160-ee47-11de-9b30-9f9d59cce923 --- .../com/timwalling/foursquare/FoursquareOperation.as | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/foursquare-as3/src/com/timwalling/foursquare/FoursquareOperation.as b/foursquare-as3/src/com/timwalling/foursquare/FoursquareOperation.as index 671643f..d3d73d9 100644 --- a/foursquare-as3/src/com/timwalling/foursquare/FoursquareOperation.as +++ b/foursquare-as3/src/com/timwalling/foursquare/FoursquareOperation.as @@ -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) { @@ -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);