Opened 14 years ago

Closed 12 years ago

#610 closed defect (fixed)

io.bind should support all HTTP Methods for REST API's

Reported by: anonymous Owned by: alex
Priority: high Milestone: 0.9
Component: IO Version: 0.3
Keywords: io rest Cc: pic@…
Blocked By: Blocking:

Description

I think the BrowserIO transport should support additional HTTP Methods, currently the canHandle method checks that the method is GET, POST or HEAD.

With the advent of REST API's additional methods are widely used (PUT, DELETE).

I'm not aware of any issues in implementing these methods.

Change History (8)

comment:1 Changed 14 years ago by Tom Trenka

Milestone: 0.3release
Version: 0.30.2

Neither Safari nor Opera 8.5 support methods other than GET and POST, that was the original reasoning. This is also a dup of another bug, will close both when we make a decision.

comment:2 Changed 14 years ago by anonymous

Owner: changed from anonymous to Tom Trenka

comment:3 Changed 14 years ago by Tom Trenka

Resolution: fixed
Status: newclosed

Check is removed, r. 3752.

comment:4 Changed 13 years ago by pic@…

Cc: pic@… added
Resolution: fixed
Status: closedreopened
Version: 0.20.3

all methods are actually accepted but some of them need something more. Particularly, PUT has to send data to the server but current code in BrowserIO.js threats it with http.send(null);

So, IMHO, for PUT you should add something similar to:

else {

if (kwArgs.method.toLowerCase() == "put") {

http.open(kwArgs.method.toUpperCase(), url, async); setHeaders(http, kwArgs); http.setRequestHeader("Content-Type", kwArgs.contentType); try{

http.send(kwArgs.postContent);

}catch(e){ if(typeof http.abort == "function"){

http.abort();

} doLoad(kwArgs, {status: 404}, url, query, useCache); }

} else other methods, GET, DELETE, ... ...

around line 516.

This code is a "proof of concept" but works well for me. Best regards.

comment:5 Changed 13 years ago by dylan

Component: GeneralIO
Milestone: 0.3release0.5
Priority: highnormal

comment:6 Changed 13 years ago by Tom Trenka

Owner: changed from Tom Trenka to alex
Status: reopenednew

Reassigning to Alex, given the rewrite work he's done with Dojo 0.9.

comment:7 Changed 13 years ago by Tom Trenka

Alex, someone on the forums was asking about REST support; did you take care of this ticket when you ported io.bind at all? Be nice to say "gee, took care of it" and close a bug ;)

comment:8 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

dojo.xhrPut, dojo.rawXhrPut, and dojox.xhrDelete have been implemented in 0.9.

Note: See TracTickets for help on using tickets.