cocoa-rest-client icon indicating copy to clipboard operation
cocoa-rest-client copied to clipboard

Set cookies

Open arvindstutzen opened this issue 10 years ago • 6 comments

is it possible to set cookies for the request?

arvindstutzen avatar Jun 07 '14 04:06 arvindstutzen

I've been getting a few requests around cookies. As it stands now, the application treats cookies the same as a web browser would although this is not visible in any way in the UI. This application uses the stock URL connection class for OS X/Cocoa and that class actually shares cookies across all applications using it. I need to dig into NSHTTPCookieStorage, but I think it should be possible.

mmattozzi avatar Jun 08 '14 23:06 mmattozzi

Although cookies are not visible, you simply can set them as request header values.

mAu888 avatar Jul 24 '14 15:07 mAu888

Very true, mAu888. It's also kind of interesting to get people requesting Cookie tooling... I always assumed this application would be used more for interacting with REST APIs, which typically don't make use of cookies to hold state on the client, but it's cool to see people doing different things with this.

mmattozzi avatar Jul 27 '14 14:07 mmattozzi

It would be cool if we could have an option to disable cookies from being set automatically. I think rest clients should be more of a stateless thing.

steveswinsburg avatar Aug 05 '14 10:08 steveswinsburg

I agree there, @steveswinsburg ... part of why I never even considered what to do with cookies is because I never tested the app against URLs that used cookies, figuring that people would be using this for more traditionally restful APIs. It definitely seems like I should dig around and find a way to disable cookies as perhaps a quicker solution than building a whole cookie manager.

mmattozzi avatar Aug 05 '14 11:08 mmattozzi

I needed to set a Cookie for a POST web service I was testing and you can do it with this tool but its not totally obvious. To save others digging for this info here's how I did it:

  • set a Request Header by typing in the "Header Name" field with: "Cookie"
  • set the cookie itself in the "Header Value" with the syntax: "Cookie_name=value"

nickdos avatar Aug 12 '14 07:08 nickdos