Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Apr 7, 2020
Merged

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

merged 4 commits into from
Apr 7, 2020

Conversation

pkboom
Copy link
Contributor

@pkboom pkboom commented Apr 7, 2020

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