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] Added ability to simulate "withCredentials" in test requests #33497

Merged
merged 1 commit into from
Jul 10, 2020
Merged

[7.x] Added ability to simulate "withCredentials" in test requests #33497

merged 1 commit into from
Jul 10, 2020

Conversation

kohlerdominik
Copy link
Contributor

@kohlerdominik kohlerdominik commented Jul 10, 2020

Hi all

I stumbled over a missing functionality in the test cases. As stated here, XMLHttpRequests allow a flag which is named "withCredentials" to include cookies in the requests.

The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting withCredentials has no effect on same-site requests.

By default, all JSON-requests implicit use an empty cookies-array. But with the knowledge of this flag, in my opinion it makes sense to make it configurable whether json requests should include cookies or not.

This PR adds a method to test cases, which allow to use $this->withCredentials() in a test to make all json()-calls include the cookie-jars, which are available anyway.

@taylorotwell taylorotwell merged commit 9053103 into laravel:7.x Jul 10, 2020
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