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

Is there a simple way to set Content-Type #17

Closed zzeroo closed 13 years ago

zzeroo commented 13 years ago

Now with couchdb < 1.0 you must set the Countent Type, like

-H "Content-Type: application/json" 

Is there a simple way to do that?

micha commented 13 years ago

Sure. You can set a config file that adds default options on a per host/method basis. Check out the "Per-Host/Per-Method Curl Configuration Files" section of the README file.

(If you just want to know how to pass options to curl then it's easy, you just specify them on the command line, see the README)

micha commented 13 years ago

Thinking about it a little more, I added the capability to specify curl options when you call the resty command to set the host/uri base. Subsequent requests (GET/POST/etc) will have those options automatically added. This is not on a per-method basis though---the options are added for all methods. To get per-method options you would want to do the config file thing as above. Have a look at the "Default Curl Options" section of the README.