public function getHeader(string $name, string $default = ''): string
    {
        switch ($this->type) {
            // Check the request is PSR-7 http message.
            case 'psr-7':
                return $this->request->getHeaderLine($name) ?: $default;

            // Check the is Laravel or Symfony.
            case 'laravel':
            case 'symfony':
                return $this->request->headers->get($name, $default);

            case 'thinkphp':
                return $this->request->header($name, $default);
        }

        // Not using framewoerk ?
        // Read global variable $_REQUEST.
        foreach ($this->request as $key => $value) {
            if (strtolower($key) === strtolower($name)) {
                return (string) $value;
            }
        }

        // return default line string.
        return $default;
    }
public function getHeader(string $name, string $default = ''): string
    {
        switch ($this->type) {
            // Check the request is PSR-7 http message.
            case 'psr-7':
                return $this->request->getHeaderLine($name) ?: $default;

            // Check the is Laravel or Symfony.
            case 'laravel':
            case 'symfony':
                return $this->request->headers->get($name, $default);

            case 'thinkphp':
                return $this->request->header($name, $default);
        }

        // Not using framewoerk ?
        // Read global variable $_REQUEST.
        foreach ($this->request as $key => $value) {
            if (strtolower($key) === strtolower($name)) {
                return (string) $value;
            }
        }

        // return default line string.
        return $default;
    }
public function getHeader ( string $ name , string $ default = '' ) : string { switch ( $ this -> type ) { // Check the request is PSR-7 http message. case 'psr-7' : return $ this -> request -> getHeaderLine ( $ name ) ? : $ default ; // Check the is Laravel or Symfony. case 'laravel' : case 'symfony' : return $ this -> request -> headers -> get ( $ name , $ default ) ; case 'thinkphp' : return $ this -> request -> header ( $ name , $ default ) ; } // Not using framewoerk ? // Read global variable $_REQUEST. foreach ( $ this -> request as $ key => $ value ) { if ( strtolower ( $ key ) === strtolower ( $ name ) ) { return ( string ) $ value ; } } // return default line string. return $ default ; }
Get header line.

@param string $name
@param string $default

@return string

@author Seven Du <shiweidu@outlook.com>
Get header line .