File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
src/Illuminate/Http/Client/Concerns Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,16 @@ public function found()
6565 return $ this ->status () === 302 ;
6666 }
6767
68+ /**
69+ * Determine if the response code was a 304 "Not Modified" response.
70+ *
71+ * @return bool
72+ */
73+ public function notModified ()
74+ {
75+ return $ this ->status () === 304 ;
76+ }
77+
6878 /**
6979 * Determine if the response was a 400 "Bad Request" response.
7080 *
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ protected function setUp(): void
5252 protected function tearDown (): void
5353 {
5454 m::close ();
55+
56+ parent ::tearDown ();
5557 }
5658
5759 public function testStubbedResponsesAreReturnedAfterFaking ()
@@ -133,6 +135,20 @@ public function testFoundRequest()
133135 $ this ->assertFalse ($ response ->found ());
134136 }
135137
138+ public function testNotModifiedRequest (): void
139+ {
140+ $ this ->factory ->fake ([
141+ 'vapor.laravel.com ' => $ this ->factory ::response ('' , HttpResponse::HTTP_NOT_MODIFIED ),
142+ 'forge.laravel.com ' => $ this ->factory ::response ('' , HttpResponse::HTTP_OK ),
143+ ]);
144+
145+ $ response = $ this ->factory ->post ('https://vapor.laravel.com ' );
146+ $ this ->assertTrue ($ response ->notModified ());
147+
148+ $ response = $ this ->factory ->post ('https://forge.laravel.com ' );
149+ $ this ->assertFalse ($ response ->notModified ());
150+ }
151+
136152 public function testBadRequestRequest ()
137153 {
138154 $ this ->factory ->fake ([
You can’t perform that action at this time.
0 commit comments