this.request

this.request

Twig Property

Allows access to the current request object, including request method.

# this.request.method

You can access the current request method object via this.request.method and it returns the HTTP verb in uppercase.

___TWIG0___
    <!-- Do GET Logic -->
___TWIG1___
    <!-- Do POST Logic -->
___TWIG2___

# this.request.ajax

To check if the current request uses the AJAX header, access the this.request.ajax property.

___TWIG0___
    Request was submitted via AJAX
___TWIG1___

# this.request.pjax

To check if the current request was made using the Turbo Router, access the this.request.pjax property.

___TWIG0___
    Page was loaded via PJAX
___TWIG1___

# this.request.pjaxCached

Use the this.request.pjaxCached property to also check if the Turbo Router request had a cached snapshot coming before it.

___TWIG0___
    Page was loaded via PJAX with a snapshot
___TWIG1___