GET needs -G to pass query string parameters #16

Closed
eproxus opened this Issue Mar 8, 2011 · 4 comments

Projects

None yet

2 participants

@eproxus
eproxus commented Mar 8, 2011

The GET command currently needs -G to work with query string parameters. My understanding of curl is that if -d is used without -G curl switches to POST instead. Shouldn't resty always use -G with the GET command?

@micha
Owner
micha commented Mar 8, 2011

RFC 2616 doesn't seem to be very specific about whether a message body can be included in a GET request or not. To me this means that you might want to send the data in the message body sometime. I agree that it would be better not needing the -G, defaulting to sending parameters in the query string, but it would be a complication to implement this.

Something that I have been meaning to take a look at is mixing query string and message body parameters in the same request. Currently you have to choose one or the other for each request. I'd like to be able to do like

POST /Blah '{foo: "bar"}' -d arg=val

to get

POST /Blah?arg=val HTTP/1.1
User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18
Host: localhost:9090
Accept: */*
Content-Length: 14
Content-Type: application/x-www-form-urlencoded

{foo:"bar"}
@-    
@eproxus
eproxus commented Mar 8, 2011

Yeah, and curl doesn't really allow -G again to cancel a GET, or any flag that forces a POST.

@micha
Owner
micha commented Mar 8, 2011

It would be possible to use another option, like -Q or something (I don't remember which letters are available--curl takes up most of the alphabet in options already), and then do some fancy footwork and insert -G only if -Q isn't specified, or something like that.

@eproxus
eproxus commented Mar 8, 2011

I think it is okay to keep it as it is, since knowing curl will allow you to do whatever you want. Right now it gives you no surprises which is always nice. :-)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment