micha / resty

Little command line REST client that you can use in pipelines (bash or zsh).
MIT License
2.65k stars 143 forks source link

Flags not passed to curl #15

Closed eproxus closed 13 years ago

eproxus commented 13 years ago

It seems that the flags are not passed to curl correctly. They are ignored:

$ resty http://localhost:8000                                    
http://localhost:8000*
$ GET /Blah
<?xml version="1.0"?><data>...</data>
$ GET /vehicle/ybinfo -H "Accept: application/json"
<?xml version="1.0"?><data>...</data>

Compared to curl:

$ curl http://localhost:8000/Blah
<?xml version="1.0"?><data>...</data>
$ curl http://localhost:8000/Blah -H "Accept: application/json"
{"data": ...} 

Using resty 1.3 under zsh 4.3.9 (i386-apple-darwin10.0) on OS X 10.6.6.

micha commented 13 years ago

Hmm. Strange behavior. I'm not sure what to make of it. I did a little test here: micha/resty@fea541b619c6cdee921de68139bdf46415f3f9a6

I get the following output in zsh:

micha@eels:resty% GET / -H asdf
curlopt[1] => '-H'
curlopt[1] == '-'
curlopt[2] => 'asdf'
curlopt[2] == 'a'
curlopt[@] == '-asdf'

Expected output (in bash it seems to work fine):

micha@eels:resty (test)$ GET / -H asdf
curlopt[1] => '-H'
curlopt[1] == '-H'
curlopt[2] => 'asdf'
curlopt[2] == 'asdf'
curlopt[@] == ' -H asdf'

Do you have any idea what could cause this?

micha commented 13 years ago

I think zsh is splitting "$i" on characters for some reason, or something. Very weird behavior.

eproxus commented 13 years ago

I can confirm the same behaviour on my setup:

$ GET / -H asdf 
curlopt[1] => '-H'
curlopt[1] == '-'
curlopt[2] => 'asdf'
curlopt[2] == 'a'
curlopt[@] == '-asdf'

My zsh-fu ends here, though.

micha commented 13 years ago

Okay, I think we got it now. Version 1.4 has the fix.

eproxus commented 13 years ago

Yup, that works! Thanks a bunch!

micha commented 13 years ago

Excellent, I will close this issue.