marpaia / chef-golang

Go library to interact with the Chef server API
Other
77 stars 31 forks source link

move Post->PostForm, add Post method that takes io.Reader as a body #3

Closed spheromak closed 10 years ago

spheromak commented 10 years ago

Post opperations to the chef-server that require data need an io object The current chef.Post implements the behavior of PostForm from standard library so I renamed it to chef.PostForm, and added chef.Post. chef.Post takes an io object and sends it to the server with the signed headers.

If you want this reversed and instead have a PostData method or something. Let me know. I am happy with that, but thought this seemed more idiomatic Go

spheromak commented 10 years ago

this is a fix for #1

spheromak commented 10 years ago

@marpaia any thoughts on this ?

marpaia commented 10 years ago

@spheromak woops, sorry, I didn't see this. It looks great, thank you for adding it!

Can you add a unit test or something that shows how it's used in api_test.go or, preferably, implement an API method that makes a post request which uses it and makes a unit test for that?

Thanks again, this is great.

spheromak commented 10 years ago

@marpaia yea no problem I was wanting to write tests for it. Wanted to make sure the approach was ok https://gist.github.com/spheromak/8678653#file-chef-go-L48-L59 is a simple refrence i used to try to exercise that api endpoint. I will look into how to test this more this weekend.

marpaia commented 10 years ago

cool, thanks again @spheromak!

spheromak commented 10 years ago

@marpaia Kicked this out while waiting for my flight back home. Let me know If you want something more complete. There wasn't an existing test for Post As far as i could see.

marpaia commented 10 years ago

@spheromak yessssss, this is epic! thank you!!!!!