Skip to content

Commit aa17e75

Browse files
committed
formatting
1 parent 9053103 commit aa17e75

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php

+13-12
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ trait MakesHttpRequests
5454
protected $encryptCookies = true;
5555

5656
/**
57-
* Indicated whether json-requests should behave like
58-
* the XHR withCredentials-flag was set.
57+
* Indicated whether JSON requests should be performed "with credentials" (cookies).
58+
*
5959
* @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
6060
*
6161
* @var bool
6262
*/
63-
protected $withCredentials;
63+
protected $withCredentials = false;
6464

6565
/**
6666
* Define additional headers to be sent with the request.
@@ -240,7 +240,7 @@ public function followingRedirects()
240240
}
241241

242242
/**
243-
* Include cookies and authorization headers in json-requests.
243+
* Include cookies and authorization headers for JSON requests.
244244
*
245245
* @return $this
246246
*/
@@ -470,8 +470,13 @@ public function json($method, $uri, array $data = [], array $headers = [])
470470
], $headers);
471471

472472
return $this->call(
473-
$method, $uri, [], $this->prepareCookiesForJsonRequest(),
474-
$files, $this->transformHeadersToServerVars($headers), $content
473+
$method,
474+
$uri,
475+
[],
476+
$this->prepareCookiesForJsonRequest(),
477+
$files,
478+
$this->transformHeadersToServerVars($headers),
479+
$content
475480
);
476481
}
477482

@@ -600,17 +605,13 @@ protected function prepareCookiesForRequest()
600605
}
601606

602607
/**
603-
* If enabled, add cookies for Json requests.
608+
* If enabled, add cookies for JSON requests.
604609
*
605610
* @return array
606611
*/
607612
protected function prepareCookiesForJsonRequest()
608613
{
609-
if ($this->withCredentials) {
610-
return $this->prepareCookiesForRequest();
611-
} else {
612-
return [];
613-
}
614+
return $this->withCredentials ? $this->prepareCookiesForRequest() : [];
614615
}
615616

616617
/**

0 commit comments

Comments
 (0)