src/rehyved/Http/HttpRequest.php
public function contentType(string $contentType): HttpRequest
    {
        $contentType = trim($contentType);

        // If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests:
        if (stripos($contentType, "multipart/") !== false) {
            if (stripos($contentType, "boundary") === false) {
                $contentType .= "; boundary=\"" . uniqid(time()) . "\"";
                $contentType = preg_replace('/(.)(;{2,})/', '$1;', $contentType); // remove double semi-colon, except after scheme
            }
        }

        return $this->header("Content-Type", $contentType);
    }
public function contentType(string $contentType): HttpRequest
    {
        $contentType = trim($contentType);

        // If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests:
        if (stripos($contentType, "multipart/") !== false) {
            if (stripos($contentType, "boundary") === false) {
                $contentType .= "; boundary=\"" . uniqid(time()) . "\"";
                $contentType = preg_replace('/(.)(;{2,})/', '$1;', $contentType); // remove double semi-colon, except after scheme
            }
        }

        return $this->header("Content-Type", $contentType);
    }
public function contentType ( string $ contentType ) : HttpRequest { $ contentType = trim ( $ contentType ) ; // If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests: if ( stripos ( $ contentType , "multipart/" ) !== false ) { if ( stripos ( $ contentType , "boundary" ) === false ) { $ contentType .= "; boundary=\"" . uniqid ( time ( ) ) . "\"" ; $ contentType = preg_replace ( '/(.)(;{2,})/' , '$1;' , $ contentType ) ; // remove double semi-colon, except after scheme } } return $ this -> header ( "Content-Type" , $ contentType ) ; }
Sets the Content-Type header of the HttpRequest
@param string $contentType the value to set for the Content-Type header
@return HttpRequest
Sets the Content - Type header of the HttpRequest