Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Is http.get() misnamed?

edited May 2012 in General Posts: 141

I am tickled pink to have networking operations now. Thank yo very much. However for a little bit I thought you only supported GET operations.

Why? Because the one and only one call is called http.get() and you have to read all the way down to find out you can do other operations.

As a suggestion, perhaps in a future version you could have http.put(), http.post(), etc calls as well. Even if they are just wrappers for http.get().

Also The documentation lists the possible methods as HEAD, GET, PUT, POST, and DELETE. Am I actually limited to them, or can I use any arbitrary method name? I ask because I have some WebDAV code I would like to adapt, and would like to be able do LOCK, UNLOCK, COPY, MOVE, etc operations as well.

Comments

  • BortelsBortels Mod
    Posts: 1,557

    You pass the method as text - ill bet it could be anything. Try it!

    And yes - http.get() as a name is... Odd. I suspect it's an artifact of the dev process, in that iirc, originally you couldn't override the method. Not 100% sure there - it was a long beta :-)

  • SimeonSimeon Admin Mod
    Posts: 4,888

    Would you prefer it to be named http.request?

    We can leave .get as a deprecated version in the next update.

  • BortelsBortels Mod
    Posts: 1,557

    Request is 4 letters too many :-) the new keyboard is awesome, but not that awesome!

    I'd say drop the http. And just make it "get" if you change it at all.

    Hmmm... Did we ever add https support?

  • beebee
    Posts: 381

    @simeon: I prefer a function for each method. It's clearer to the eye and documentation. The 'http' namespace "demands" some methods. :) But, if it's not possible for whatever reasons, http.request() would be sufficient.

  • beebee
    edited May 2012 Posts: 381

    @bortels: I disgress if the 'http' got dropped completely. 'get' is too common name for a method in public namespace; to get what? And, 'https' should be THE 4th parameter. ;)

  • Posts: 159

    @Bortels I'd say 'get' is a little too generic to not be namespaced! 'http.' gives it some context.

  • BortelsBortels Mod
    Posts: 1,557

    Wget then? Like the command line program...

    I'm actually used to http.get() now, so meh.

  • Posts: 141

    @simeon I would like http.request() for the generic operation, and then wrappers for GET, PUT, POST since they are the most common things to do.

    BTW what about the second part of my question? Am I limited to just HEAD, GET, PUT, POST, and DELETE?

  • SimeonSimeon Admin Mod
    edited May 2012 Posts: 4,888

    @JockM that sounds like a good idea. We'll try move on this quickly so "get" can be changed appropriately.

    You can set the method (I believe even to a custom string) and add custom headers.

  • Posts: 141

    @Simeon Awesome, on both accounts.

Sign In or Register to comment.