[Dojo-checkins] [dojo] #4314: Query parameters are not passed to the server with dojo.xhrPut()
dojo
trac at dojotoolkit.org
Mon Jul 19 14:05:52 EDT 2010
#4314: Query parameters are not passed to the server with dojo.xhrPut()
--------------------+-------------------------------------------------------
Reporter: guest | Owner: jburke
Type: defect | Status: closed
Priority: normal | Milestone: 1.0
Component: IO | Version: 0.9
Severity: major | Resolution: invalid
Keywords: xhrPut |
--------------------+-------------------------------------------------------
Changes (by jburke):
* status: reopened => closed
* resolution: => invalid
Comment:
Right now there is no good way to specify some parameters that should go
in the querystring (URL) and some parameters go in the body of an HTTP
request. We default in Dojo to using one or the other based on accepted
HTTP semantics, namely that POST and PUT should send content in the HTTP
body.
So I am not sure what the fix would be without complicating the API for
what seems like edge cases, improper use of query strings and bodies. Note
that you can still use those kinds of APIs with Dojo's XHR calls, you just
have to know what args go where, which is what you would have to do if we
were to expose some API for you to target some parameters for the URL and
some for the HTTP body.
This sort of use of Dojo APIs could help with the particular IBM example,
and I do not believe it would be much different as far as the amount of
typing if we were to support some API in dojo.xhr itself to do this work:
{{{
dojo.xhrPut({
url: '/rest/bpm/htm/v1/task/someId?' + dojo.objectToQuery({action:
'complete'}),
putData: "<some xml string goes here>"
});
}}}
Using dojo.objectToQuery is the generic tool to use for this pattern, but
for the specific IBM URL, since only "complete" is the only valid value,
then you could just hardcode the "?action=complete" as part of the URL,
which would be the most efficient as far as typing and runtime
performance.
I am going to close this because I do not believe it is worth complicating
the dojo.xhr APIs with some way to list both URL and body arguments when
dojo.objectToQuery will do the job just as well for these cases. However,
if you see a reason for otherwise, please feel free to reopen with more
info and possibly ideas on how a change to the dojo.xhr* calls so as to
not complicate the API.
--
Ticket URL: <http://trac.dojotoolkit.org/ticket/4314#comment:8>
dojo <http://dojotoolkit.org/>
The Dojo UI Toolkit
More information about the Dojo-checkins
mailing list