Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added example on how to use Cookie #124

Merged
merged 2 commits into from
Apr 27, 2015
Merged

Added example on how to use Cookie #124

merged 2 commits into from
Apr 27, 2015

Conversation

catharsisjelly
Copy link
Contributor

Took me a little while to figure out how to use Cookies in the request so I though I would contribute an example

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) when pulling dc838a8 on catharsisjelly:master into b398534 on rmccue:master.

@ozh
Copy link
Collaborator

ozh commented Aug 18, 2014

Very neat idea! Why not simply use http://httpbin.org/cookies though?

@staabm
Copy link
Contributor

staabm commented Aug 18, 2014

The above example sends a cookie to httpbin.org. The url http://httpbin.org/cookies responds with a cookie which is a different use case

@ozh
Copy link
Collaborator

ozh commented Aug 18, 2014

Yes, I got that, but using /cookies instead of /get simply shows the cookie content in a human readable JSON body, much easier to check & parse than the response header in your example. My 2 cents.

@staabm
Copy link
Contributor

staabm commented Aug 18, 2014

Ah, I see.

@catharsisjelly
Copy link
Contributor Author

@ozh I didn't actually know httpbin did this (never heard of it before) but I like this addition, will add it in

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) when pulling 819c545 on catharsisjelly:master into b398534 on rmccue:master.

@rmccue
Copy link
Collaborator

rmccue commented Apr 27, 2015

Thanks! You can also pass in a Requests_Cookie_Jar as well, which is the preferred option, and it'll add the required headers for you.

(Happy to accept a follow-up PR to add that into the examples too!)

rmccue added a commit that referenced this pull request Apr 27, 2015
Added example on how to use Cookie
@rmccue rmccue merged commit aa2168e into WordPress:master Apr 27, 2015
@rmccue rmccue added this to the 1.7 milestone Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants