Allow to get CookieJar in IClientService
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
With IClientService you can get a wrapped GuzzleClient.
However you have no way to keep the cookies with our API.
The following would work:
$cookieJar = new \GuzzleHttp\Cookie\CookieJar();
$client = $this->clientService->newClient();
$response = $client->post(
'.../login', [
'body' => [
'name' => $name,
'password' => $password,
],
'cookies' => $cookieJar,
]
);
$response = $client->get(
'.../authed-api', [
'cookies' => $cookieJar,
]
);
I think we should add a newCookieJar() method to the clientService, to hide the Guzzle CookieJar. I just don't know what to do with the interface, Should we add a dummy around it like with the client? and forward all calls to the internal?
cc @MorrisJobke @rullzer agreed and okay for 16?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the IClientService and its clientService implementation, then inspect the existing wrapped Guzzle client and its interface dummy. Determine how a CookieJar can be exposed without leaking the internal client abstraction. Done means callers can create a jar, pass it to successive requests, and retain cookies across those requests with appropriate interface coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100