matryer / silk

Markdown based document-driven RESTful API testing.
http://silktest.org/
GNU General Public License v2.0
942 stars 69 forks source link

how does it handle cookies? #14

Closed nicolai86 closed 8 years ago

nicolai86 commented 8 years ago

Hey!

Silk looks interesting! How does it handle dependent api requests, and cookie based authentication?

Eg a user logs in, then CRUDs a todo?

ajayep commented 8 years ago

Hi ,

Silk is really cool. I too have the same issue on handling cookie based authentication with Silk

matryer commented 8 years ago

Great question. Right now it doesn't. How should it?

On 11 Feb 2016, at 20:23, Raphael Randschau notifications@github.com wrote:

Hey!

Silk looks interesting! How does it handle dependent api requests, and cookie based authentication?

Eg a user logs in, then CRUDs a todo?

— Reply to this email directly or view it on GitHub.

matryer commented 8 years ago

Gophers can use the runner package to do this easily enough I think. But I wonder if it's common enough a problem to solve in the docs?

On 12 Feb 2016, at 08:04, ajayep notifications@github.com wrote:

Hi ,

Silk is really cool. I too have the same issue on handling cookie based authentication with Silk

— Reply to this email directly or view it on GitHub.

matryer commented 8 years ago

For cookies, how about this:

## GET /protected-resource
  * Cookie: authtoken=value
  * Cookie: name=John
ajayep commented 8 years ago

Cookie set by the server needs to be copied by the client for all subsequent requests. I believe this would involve some tweak in the runner package as well.

nicolai86 commented 8 years ago

@matryer I like your markdown suggestion. This would be really great!

How would it look like if you'd want to store the cookie only for subsequent requests, eg its value is determined by first request but should be stored for subsequent requests?

matryer commented 8 years ago

I think https://github.com/matryer/silk/issues/2 would address the sharing/reusing data, and cookies should be included too.

matryer commented 8 years ago

@nicolai86 @ajayep

Can you guys please review this: https://github.com/matryer/silk/pull/27

It turns out, you can already set cookies using HTTP headers :) That was a nice surprise.

nicolai86 commented 8 years ago

@matryer it works, but without #2 it's of no use to me since I need to store server send values and use them in subsequent requests.

matryer commented 8 years ago

Please try #2, now implemented in v0.4.0