Laravel by Matt Stauffer
Author:Matt Stauffer
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2019-04-08T04:00:00+00:00
/** * The trusted proxies for this application * * @var array */ protected $proxies = [ '192.168.1.1', '192.168.1.2', ]; /** * The headers that should be used to detect proxies * * @var string */ protected $headers = Request::HEADER_X_FORWARDED_ALL;
As you can see, the $headers array defaults to trusting all forwarded headers from the trusted proxies; if you want to customize this list, take a look at the Symfony docs on trusting proxies.
Testing
Outside of the context of you as a developer using requests, responses, and middleware in your own testing, Laravel itself actually uses each quite a bit.
When you’re doing application testing with calls like $this->get('/'), you’re instructing Laravel’s application testing framework to generate request objects that represent the interactions that you’re describing. Then those request objects are passed to your application as these were actual visits. That’s why the application tests are so accurate: your application doesn’t actually “know” that it’s not a real user that’s interacting with it.
In this context, many of the assertions you’re making—say, assertResponseOk()—are assertions against the response object generated by the application testing framework. The assertResponseOk() method just looks at the response object and asserts that its isOk() method returns true—which is just checking that its status code is 200. In the end, everything in application testing is acting as if this were a real page request.
Find yourself in a context where you need a request to work with in your tests? You can always pull one from the container with $request = request(). Or you could create your own—the constructor parameters for the Request class, all optional, are as follows:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Blogging & Blogs | eBay |
E-Commerce | Hacking |
Online Searching | Podcasts & Webcasts |
Search Engine Optimization | Social Media |
Social Media for Business | Web Browsers |
Web Marketing |
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7582)
Grails in Action by Glen Smith Peter Ledbrook(7486)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6203)
Kotlin in Action by Dmitry Jemerov(4844)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3151)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2959)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2836)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2663)
The Art Of Deception by Kevin Mitnick(2428)
Drugs Unlimited by Mike Power(2286)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2177)
Writing for the Web: Creating Compelling Web Content Using Words, Pictures and Sound (Eva Spring's Library) by Lynda Felder(2137)
SEO 2018: Learn search engine optimization with smart internet marketing strategies by Adam Clarke(2085)
JavaScript by Example by S Dani Akash(2017)
Wireless Hacking 101 by Karina Astudillo(1950)
DarkMarket by Misha Glenny(1948)
Full-Stack React Projects by Shama Hoque(1856)
Social Selling Mastery by Jamie Shanks(1827)
Hack and HHVM by Owen Yamauchi(1755)