RequestBuilder.sendRequest not working as expected

127 views
Skip to first unread message

Vicky

unread,
Jan 3, 2012, 7:42:08 AM1/3/12
to Google Web Toolkit
Hi,

I am trying to use this API by passing the required data and callback
value. I know the data should be in the form
"name1=value1&name2=value2".

The base URL does not have any existing query parameters. Also the
request type is GET.

The API does not throw any exception, it makes the server call but the
query parameters do not reach the server end.

As a workaround i, put these parameters as part of the URL itself as "?
name1=value1&name2=value2", while passing null in sendRequest call.
This worked perfectly fine.

I don't understand why does this not work when passing data as part of
sendRequest API but works if passed directly as part of the URL.

Thanks,
Vicky

Thomas Broyer

unread,
Jan 3, 2012, 7:47:19 AM1/3/12
to google-we...@googlegroups.com
A GET request has no "body", and the first argument to sendRequest (equivalent to calling setData) represents the request body. Therefore, passing anything other than null or an empty string makes no sense for a GET request. Your "workaround" is actually the proper way of doing it.

Vicky

unread,
Jan 3, 2012, 8:34:37 AM1/3/12
to Google Web Toolkit
Aah ok. So what you are saying is, in case of GET i should append it
to the URL itself as part of the query parameters and use setData or
pass it via sendRequest only when using a POST (i.e. sending data via
body).
Reply all
Reply to author
Forward
0 new messages