Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
themeEmacs
titlegenericTest.php -- regularExceptionTest
        $wrapper = new NetWrapper();
        try {
            $wrapper->request('http://ipv4.netcurl.org/http.php?code=404&message=Error404+Generated');
        } catch (ExceptionHandler $e) {
            $code = $e->getCode();
        }
        $reqCode = $wrapper->getCode();

Custom headers

As of v6.1.2, a patch has been added to keep custom headers intact. The curlwrapper usually resets all content each "round" it is running, so the modules does not have to be reinstantiated for each new call. By means, this also resets custom headers. A problem was discovered with the cachet Statuspage where authentication tokens was reset each time the monitoring script used to update components. For 6.1.2 this is fixed in the setCurlHeader() method with a third argument, that sets the specific header to a static. So each time the scripts are running, all static headers will stay put despite the reset.

The same with static custom headers are also patched into NetWrapper and the simple streamwrapper, so as of 6.1.2 setHeader() as been added to the CurlWrapper, SimpleStreamWrapper and NetWrapper to keep the calls generic.