Skip to content

Commit 45754fd

Browse files
axlontaylorotwell
andauthored
[9.x] Add function for testing HEAD requests (#41664)
* Add function for testing HEAD requests * Update MakesHttpRequests.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 9ec9dad commit 45754fd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ public function deleteJson($uri, array $data = [], array $headers = [])
432432
public function options($uri, array $data = [], array $headers = [])
433433
{
434434
$server = $this->transformHeadersToServerVars($headers);
435+
435436
$cookies = $this->prepareCookiesForRequest();
436437

437438
return $this->call('OPTIONS', $uri, $data, $cookies, [], $server);
@@ -450,6 +451,22 @@ public function optionsJson($uri, array $data = [], array $headers = [])
450451
return $this->json('OPTIONS', $uri, $data, $headers);
451452
}
452453

454+
/**
455+
* Visit the given URI with a HEAD request.
456+
*
457+
* @param string $uri
458+
* @param array $headers
459+
* @return \Illuminate\Testing\TestResponse
460+
*/
461+
public function head($uri, array $headers = [])
462+
{
463+
$server = $this->transformHeadersToServerVars($headers);
464+
465+
$cookies = $this->prepareCookiesForRequest();
466+
467+
return $this->call('HEAD', $uri, [], $cookies, [], $server);
468+
}
469+
453470
/**
454471
* Call the given URI with a JSON request.
455472
*

0 commit comments

Comments
 (0)