nextcloud/server

Allow to get CookieJar in IClientService

オープン

#14,447 opened on 2019/02/28

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)PHP (4,865 件のフォーク)batch import
1. to developenhancementgood first issueperformance 🚀technical debt

Repository metrics

Stars
 (34,953 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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?

コントリビューターガイド