Ticket #610 (closed defect: fixed)

Opened 3 years ago

Last modified 16 months ago

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

Reported by: anonymous Owned by: alex
Priority: normal Milestone: 0.9
Component: IO Version: 0.3
Severity: major Keywords: io rest
Cc: pic@…

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

Changed 3 years ago by ttrenka

  • version changed from 0.3 to 0.2
  • milestone set to 0.3release

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.

Changed 3 years ago by anonymous

  • owner changed from anonymous to ttrenka

Changed 3 years ago by ttrenka

  • status changed from new to closed
  • resolution set to fixed

Check is removed, r. 3752.

Changed 2 years ago by pic@…

  • cc pic@… added
  • status changed from closed to reopened
  • version changed from 0.2 to 0.3
  • resolution deleted

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.

Changed 2 years ago by dylan

  • priority changed from high to normal
  • component changed from General to IO
  • milestone changed from 0.3release to 0.5

Changed 18 months ago by ttrenka

  • owner changed from ttrenka to alex
  • status changed from reopened to new

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

Changed 18 months ago by ttrenka

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 ;)

Changed 16 months ago by alex

  • status changed from new to closed
  • resolution set to fixed

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

Note: See TracTickets for help on using tickets.