On Thu, Aug 7, 2008 at 4:38 AM, Jochen Luig <
jochen.luig@...> wrote:
> 1.) dojo.rawXhrPost isn't documented exhaustively. E.g. the (quite
> recent) Addison Wesley Dojo Book
> (
http://www.amazon.com/Dojo-JavaScript-Library-Applications-Developers/dp/0132358042/ref=pd_bbs_sr_3?ie=UTF8&s=books&qid=1218108346&sr=8-3 ) doesn't mention the function at all. Is it likely to be deprecated anytime soon (or is it already)? If so, what would be a reasonable alternative?
Since it is a public API, it will be supported for all Dojo 1.x
releases. You are safe to continue using it.
> 2.) having to override the Content-Type header by hand seems quite
> "hackish" to me. Is there another way?
When you do a raw post, you are deciding to handle encoding of the
request body yourself. Since Dojo cannot guess what kind of encoding
you will do, then you need to specifically tell it. Also, it is not
uncommon with other dojo.rawXhrPost calls to want to set other HTTP
headers. The headers object seems like a nice way to allow you to
specify all the headers you want.
> 3.) the conditional in the handler function (I found that one in a
> tutorial) always gets into the "else" part even if it gets back a 405
> response code from the server. Is that expected behaviour? I would have
> expected anything in the 400-range to result in an error. How can I do
> different things according to specific http response codes?
If you have:
handle: function (data, args) {}
then args.xhr will be the XMLHttpRequest object. You can do a test for
args.xhr.status to get the HTTP status code and branch your code
accordingly.
James
_______________________________________________
FAQ:
http://dojotoolkit.org/support/faqBook:
http://dojotoolkit.org/docs/bookForums:
http://dojotoolkit.org/forumDojo-interest@...
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest