Skip to content

[7.x] Check a request header with an array value#32274

Merged
taylorotwell merged 4 commits into
laravel:7.xfrom
pkboom:check-request-array-header
Apr 7, 2020
Merged

[7.x] Check a request header with an array value#32274
taylorotwell merged 4 commits into
laravel:7.xfrom
pkboom:check-request-array-header

Conversation

@pkboom

@pkboom pkboom commented Apr 7, 2020

Copy link
Copy Markdown
Contributor

This PR enables to check if a request has a header with a value of an array. Currently, if a header has a value of an array, it cannot be verified. For example,

Http::withHeaders([
    'X-Foo'  => ['Bar', 'Baz'],
])->get('/');
Http::assertSent(function ($request) {
    return $request->hasHeader('X-Foo', ['Bar', 'Baz']); => false
});

This PR will enable to verify header values inside an array.

 $request->hasHeader('X-Foo', ['Bar', 'Baz']); => true.
 $request->hasHeader('X-Foo', 'Bar'); => true.
 $request->hasHeader('X-Foo', ['Bar']); => true.

@pkboom pkboom changed the title Check a request header with an array value [7.x] Check a request header with an array value Apr 7, 2020
@taylorotwell taylorotwell merged commit 9d3c45b into laravel:7.x Apr 7, 2020
@pkboom pkboom deleted the check-request-array-header branch April 7, 2020 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants