src/Support/Web/WebRequest.php
/**
     * Returns an array of all headers to send for the request.
     *
     * @param string[] $userHeaders
     * @return array
     */
Returns an array of all headers to send for the request.
@param string[] $userHeaders
@return array
Returns an array of all headers to send for the request . @param string [] $userHeaders @return array
protected function calculateHeaders($userHeaders = []) {
        $original = $this->getHeaders();
        $headers = [];
        $skipCookies = false;
        if (!empty($this->cookies)) {
            $skipCookies = true;
            $headers[] = 'Cookie: ' . $this->calculateCookies();
        }
        foreach ($original as $header => $value) {
            $header = strtolower($header);
            if ($skipCookies && $header === 'cookie') continue;
            $headers[] = $header . ': ' . $value;
        }
        foreach ($userHeaders as $header => $value) {
            $header = strtolower($header);
            if ($skipCookies && $header === 'cookie') continue;
            $headers[] = $header . ': ' . $value;
        }
         and return
        return $headers;
    }
protected function calculateHeaders ( $ userHeaders = [ ] ) { $ original = $ this -> getHeaders ( ) ; $ headers = [ ] ; $ skipCookies = false ; if ( ! empty ( $ this -> cookies ) ) { $ skipCookies = true ; $ headers [ ] = 'Cookie: ' . $ this -> calculateCookies ( ) ; } foreach ( $ original as $ header => $ value ) { $ header = strtolower ( $ header ) ; if ( $ skipCookies && $ header === 'cookie' ) continue ; $ headers [ ] = $ header . ': ' . $ value ; } foreach ( $ userHeaders as $ header => $ value ) { $ header = strtolower ( $ header ) ; if ( $ skipCookies && $ header === 'cookie' ) continue ; $ headers [ ] = $ header . ': ' . $ value ; } return $ headers ; }
Returns an array of all headers to send for the request.
Returns an array of all headers to send for the request .
// Add cookies // Add client headers // Add user headers // Add user headers and return