20 private $shouldRemoveUserInfo;
25 public function __construct($shouldRremoveUserInfo =
true)
27 $this->shouldRemoveUserInfo = (bool) $shouldRremoveUserInfo;
35 $uri = $request->getUri();
36 $userInfo = $uri->getUserInfo();
38 if (!empty($userInfo)) {
39 if ($this->shouldRemoveUserInfo) {
40 $request = $request->withUri($uri->withUserInfo(
''));
43 $request = $request->withHeader(
'Authorization', sprintf(
'Basic %s', base64_encode($userInfo)));