kennylerma / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

Facebook.batchRequest does not work with fqlQuery #350

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Call Facebook.batchRequest() with a batch containing:
batch.add('method/fql.query', null, {'query':"select first_name from user where 
uid = 208795"});

What is the expected output? What do you see instead?
We should get the user first name. We get an error instead about a missing 
query parameter.

What version of the product are you using? On what operating system?
1.7

Fix:
Correctly implement Facebook specs: body is used for POST requests only. GET 
should use the relative_url params.

In FacebookBatchRequest, replace:

if (request.params) {
  params.body = this.objectToURLVariables(request.params).toString();
}

by:

if (request.params) {
  var urlVars:String = this.objectToURLVariables(request.params).toString();
  if(request.requestMethod == URLRequestMethod.GET || request.requestMethod.toUpperCase() == "DELETE")
    params.relative_url += "?" + urlVars;
  else
    params.body = urlVars;
}               

Original issue reported on code.google.com by alexis.h...@gmail.com on 7 Sep 2011 at 9:41

GoogleCodeExporter commented 9 years ago
Good catch, thanks for the heads up! The fix will be added to the svn repo and 
be included in the next version

Original comment by edwar...@gmail.com on 15 Sep 2011 at 7:42

GoogleCodeExporter commented 9 years ago
added to 1.8

Original comment by edwar...@gmail.com on 6 Oct 2011 at 3:49