diff --git a/lib/XRay.php b/lib/XRay.php index 273e6fa..da76868 100644 --- a/lib/XRay.php +++ b/lib/XRay.php @@ -30,7 +30,12 @@ class XRay { public function parse($url, $opts_or_body=false, $opts_for_body=[]) { if(!$opts_or_body || is_array($opts_or_body)) { $fetch = new XRay\Fetcher($this->http); - $response = $fetch->fetch($url, $opts_or_body); + if (is_array($opts_or_body)) { + $fetch_opts = array_merge($this->defaultOptions, $opts_or_body); + } else { + $fetch_opts = $this->defaultOptions; + } + $response = $fetch->fetch($url, $fetch_opts); if(!empty($response['error'])) return $response; $body = $response['body']; diff --git a/tests/LibraryTest.php b/tests/LibraryTest.php index 3218bbd..2a70683 100644 --- a/tests/LibraryTest.php +++ b/tests/LibraryTest.php @@ -108,5 +108,4 @@ class LibraryTest extends PHPUnit\Framework\TestCase $normalXRay->parse($url, $html) ); } - }