Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 10, 2020
1 parent 9053103 commit aa17e75
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ trait MakesHttpRequests
protected $encryptCookies = true;

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

/**
* Define additional headers to be sent with the request.
Expand Down Expand Up @@ -240,7 +240,7 @@ public function followingRedirects()
}

/**
* Include cookies and authorization headers in json-requests.
* Include cookies and authorization headers for JSON requests.
*
* @return $this
*/
Expand Down Expand Up @@ -470,8 +470,13 @@ public function json($method, $uri, array $data = [], array $headers = [])
], $headers);

return $this->call(
$method, $uri, [], $this->prepareCookiesForJsonRequest(),
$files, $this->transformHeadersToServerVars($headers), $content
$method,
$uri,
[],
$this->prepareCookiesForJsonRequest(),
$files,
$this->transformHeadersToServerVars($headers),
$content
);
}

Expand Down Expand Up @@ -600,17 +605,13 @@ protected function prepareCookiesForRequest()
}

/**
* If enabled, add cookies for Json requests.
* If enabled, add cookies for JSON requests.
*
* @return array
*/
protected function prepareCookiesForJsonRequest()
{
if ($this->withCredentials) {
return $this->prepareCookiesForRequest();
} else {
return [];
}
return $this->withCredentials ? $this->prepareCookiesForRequest() : [];
}

/**
Expand Down

0 comments on commit aa17e75

Please sign in to comment.