nextcloud/server

Allow to get CookieJar in IClientService

开放

#14,447 创建于 2019年2月28日

 (4 条评论) (0 个反应) (0 位负责人)PHP (4,865 个派生)batch import
1. to developenhancementgood first issueperformance 🚀technical debt

仓库指标

星标
 (34,953 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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?

贡献者指南