Automattic\WooCommerce\Internal\Abilities\REST
RestAbilityFactory::get_http_method_for_operation
Get HTTP method for a given operation type.
Method of the class: RestAbilityFactory{}
No Hooks.
Returns
String. HTTP method (GET, POST, PUT, DELETE).
Usage
$result = RestAbilityFactory::get_http_method_for_operation( $operation ): string;
- $operation(string) (required)
- Operation type (list, get, create, update, delete).
RestAbilityFactory::get_http_method_for_operation() RestAbilityFactory::get http method for operation code WC 10.7.0
private static function get_http_method_for_operation( string $operation ): string {
$method_map = array(
'list' => 'GET',
'get' => 'GET',
'create' => 'POST',
'update' => 'PUT',
'delete' => 'DELETE',
);
return $method_map[ $operation ] ?? 'GET';
}