File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,27 @@ public function testOptionsHeadersNotUsingPopulate()
199199 $ this ->assertSame ('' , $ request ->header ('Accept-Encoding ' )->getValue ());
200200 }
201201
202+ public function testDefaultOptionsAreSharedBetweenRequests ()
203+ {
204+ $ options = [
205+ 'form_params ' => ['studio ' => 1 ],
206+ 'user_agent ' => 'CodeIgniter Framework v4 ' ,
207+ ];
208+ $ request = $ this ->getRequest ($ options );
209+
210+ $ request ->request ('POST ' , 'https://realestate1.example.com ' );
211+
212+ $ this ->assertSame ('https://realestate1.example.com ' , $ request ->curl_options [CURLOPT_URL ]);
213+ $ this ->assertSame ('studio=1 ' , $ request ->curl_options [CURLOPT_POSTFIELDS ]);
214+ $ this ->assertSame ('CodeIgniter Framework v4 ' , $ request ->curl_options [CURLOPT_USERAGENT ]);
215+
216+ $ request ->request ('POST ' , 'https://realestate2.example.com ' );
217+
218+ $ this ->assertSame ('https://realestate2.example.com ' , $ request ->curl_options [CURLOPT_URL ]);
219+ $ this ->assertSame ('studio=1 ' , $ request ->curl_options [CURLOPT_POSTFIELDS ]);
220+ $ this ->assertSame ('CodeIgniter Framework v4 ' , $ request ->curl_options [CURLOPT_USERAGENT ]);
221+ }
222+
202223 public function testHeaderContentLengthNotSharedBetweenRequests ()
203224 {
204225 $ options = [
Original file line number Diff line number Diff line change @@ -199,6 +199,27 @@ public function testOptionsHeadersNotUsingPopulate()
199199 $ this ->assertSame ('' , $ request ->header ('Accept-Encoding ' )->getValue ());
200200 }
201201
202+ public function testOptionsAreSharedBetweenRequests ()
203+ {
204+ $ options = [
205+ 'form_params ' => ['studio ' => 1 ],
206+ 'user_agent ' => 'CodeIgniter Framework v4 ' ,
207+ ];
208+ $ request = $ this ->getRequest ($ options );
209+
210+ $ request ->request ('POST ' , 'https://realestate1.example.com ' );
211+
212+ $ this ->assertSame ('https://realestate1.example.com ' , $ request ->curl_options [CURLOPT_URL ]);
213+ $ this ->assertSame ('studio=1 ' , $ request ->curl_options [CURLOPT_POSTFIELDS ]);
214+ $ this ->assertSame ('CodeIgniter Framework v4 ' , $ request ->curl_options [CURLOPT_USERAGENT ]);
215+
216+ $ request ->request ('POST ' , 'https://realestate2.example.com ' );
217+
218+ $ this ->assertSame ('https://realestate2.example.com ' , $ request ->curl_options [CURLOPT_URL ]);
219+ $ this ->assertSame ('studio=1 ' , $ request ->curl_options [CURLOPT_POSTFIELDS ]);
220+ $ this ->assertSame ('CodeIgniter Framework v4 ' , $ request ->curl_options [CURLOPT_USERAGENT ]);
221+ }
222+
202223 /**
203224 * @backupGlobals enabled
204225 */
You can’t perform that action at this time.
0 commit comments