Automattic\WooCommerce\StoreApi\Routes\V1
AbstractRoute::get_response_by_request_method
Get the route response based on the type of request.
Метод класса: AbstractRoute{}
Хуков нет.
Возвращает
\WP_REST_Response
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_response_by_request_method( $request );
- $request(WP_REST_Request) (обязательный)
- Request object.
Код AbstractRoute::get_response_by_request_method() AbstractRoute::get response by request method WC 10.0.2
protected function get_response_by_request_method( \WP_REST_Request $request ) { switch ( $request->get_method() ) { case 'POST': return $this->get_route_post_response( $request ); case 'PUT': case 'PATCH': return $this->get_route_update_response( $request ); case 'DELETE': return $this->get_route_delete_response( $request ); } return $this->get_route_response( $request ); }