POST non-form data?

13 views
Skip to first unread message

nojo

unread,
Feb 10, 2009, 1:36:05 PM2/10/09
to Ojay talk
Does Ojay have the capability to POST non-form data? Name-value pairs
can be posted, but form data might also consist of some chunk of data
(and generally does in RESTful applications). What I'd really like to
be able to do is to POST a string representing a JSON object as the
body of the POST, not as the value of a name-value pair. I don't see
a way to do this with Ojay.

Thanks.

Nolan

Benedict Eastaugh

unread,
Feb 10, 2009, 6:41:47 PM2/10/09
to ojay...@googlegroups.com

There isn't currently a way to do this; the Ojay.HTTP.Request class
assumes that key-value pairs (provided as a JavaScript object) will be
used to form the body of the POST request. I'm working on a patch to
remedy this; I'll post an update once I've got James to check it over.

In the meantime, you can always use the YAHOO.Util.Connect class
directly; the Ojay.HTTP methods are just a wrapper around it.

http://developer.yahoo.com/yui/docs/YAHOO.util.Connect.html

James Coglan

unread,
Feb 11, 2009, 6:09:21 AM2/11/09
to Ojay talk


On Feb 10, 11:41 pm, Benedict Eastaugh <ionf...@gmail.com> wrote:
> > Does Ojay have the capability to POST non-form data?  Name-value pairs
> > can be posted, but form data might also consist of some chunk of data
> > (and generally does in RESTful applications).  What I'd really like to
> > be able to do is to POST a string representing a JSON object as the
> > body of the POST, not as the value of a name-value pair.  I don't see
> > a way to do this with Ojay.
>
> There isn't currently a way to do this; the Ojay.HTTP.Request class
> assumes that key-value pairs (provided as a JavaScript object) will be
> used to form the body of the POST request. I'm working on a patch to
> remedy this; I'll post an update once I've got James to check it over.

Benedict's patch is now in the main repo, which we've just move to
github:
http://github.com/othermedia/ojay/commit/36a660dd0580cdfb0ee136d0e853dc8ccb423159

We should be putting out a new minor release soon (before the end of
the month I expect) so expect to see that functionality in the new
release.
Reply all
Reply to author
Forward
0 new messages