Title: HttpMethodEnum
Published: May 20, 2026

---

# class HttpMethodEnum {}

## In this article

 * [Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#wp--skip-link--target)

Represents HTTP request methods.

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#methods)󠁿

| Name | Description | 
| [HttpMethodEnum::hasBody](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/hasbody/) | Checks if this method typically has a request body. | 
| [HttpMethodEnum::isIdempotent](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/isidempotent/) | Checks if this method is idempotent. |

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#source)󠁿

    ```php
    final class HttpMethodEnum extends AbstractEnum
    {
        /**
         * GET method for retrieving resources.
         *
         * @var string
         */
        public const GET = 'GET';
        /**
         * POST method for creating resources.
         *
         * @var string
         */
        public const POST = 'POST';
        /**
         * PUT method for updating/replacing resources.
         *
         * @var string
         */
        public const PUT = 'PUT';
        /**
         * PATCH method for partially updating resources.
         *
         * @var string
         */
        public const PATCH = 'PATCH';
        /**
         * DELETE method for removing resources.
         *
         * @var string
         */
        public const DELETE = 'DELETE';
        /**
         * HEAD method for retrieving headers only.
         *
         * @var string
         */
        public const HEAD = 'HEAD';
        /**
         * OPTIONS method for retrieving allowed methods.
         *
         * @var string
         */
        public const OPTIONS = 'OPTIONS';
        /**
         * CONNECT method for establishing tunnel.
         *
         * @var string
         */
        public const CONNECT = 'CONNECT';
        /**
         * TRACE method for diagnostic purposes.
         *
         * @var string
         */
        public const TRACE = 'TRACE';
        /**
         * Checks if this method is idempotent.
         *
         * @since 0.1.0
         *
         * @return bool True if the method is idempotent, false otherwise.
         */
        public function isIdempotent(): bool
        {
            return in_array($this->value, [self::GET, self::HEAD, self::OPTIONS, self::TRACE, self::PUT, self::DELETE], \true);
        }
        /**
         * Checks if this method typically has a request body.
         *
         * @since 0.1.0
         *
         * @return bool True if the method typically has a body, false otherwise.
         */
        public function hasBody(): bool
        {
            return in_array($this->value, [self::POST, self::PUT, self::PATCH], \true);
        }
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/src/providers/http/enums/httpmethodenum.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/php-ai-client/src/Providers/Http/Enums/HttpMethodEnum.php#L32)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/php-ai-client/src/Providers/Http/Enums/HttpMethodEnum.php#L32-L110)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-enums-httpmethodenum/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.1.0](https://developer.wordpress.org/reference/since/0.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwordpress-aiclient-providers-http-enums-httpmethodenum%2F)
before being able to contribute a note or feedback.