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()
65
65
return $ this ->status () === 302 ;
66
66
}
67
67
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
+
68
78
/**
69
79
* Determine if the response was a 400 "Bad Request" response.
70
80
*
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ protected function setUp(): void
52
52
protected function tearDown (): void
53
53
{
54
54
m::close ();
55
+
56
+ parent ::tearDown ();
55
57
}
56
58
57
59
public function testStubbedResponsesAreReturnedAfterFaking ()
@@ -133,6 +135,20 @@ public function testFoundRequest()
133
135
$ this ->assertFalse ($ response ->found ());
134
136
}
135
137
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
+
136
152
public function testBadRequestRequest ()
137
153
{
138
154
$ this ->factory ->fake ([
You can’t perform that action at this time.
0 commit comments