Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.59k stars 593 forks source link

Add ability to set a default cookie #374

Closed HugoBtcc closed 3 years ago

HugoBtcc commented 3 years ago

The feature would work like the addDefaultHeader() method in Config.java. I need to set a cookie that will appear on all my request. I don't want to explicitly set it every time using the cookie() method. Maybe there's already some way to do this?

The use case for me is end-to-end testing, where I log in using an entirely other system (selenium), retrieve the session cookie, convert it and pass it to Unirest to auth all my requests to the API.

I've been using an old fork of Unirest that allows this but I wish to switch back for all the recently added features.

ryber commented 3 years ago

Cookies are just a type of header so this is literally just some sugar in the config class. I was going to cut a release tomorrow, this will be in it.

ryber commented 3 years ago

Complete in 3.11.02