| 1 | --- |
| 2 | title: "HX-Request-Type" |
| 3 | description: "Indicates if this is a partial or full page request" |
| 4 | --- |
| 5 | |
| 6 | The `HX-Request-Type` request header indicates if request targets a specific element or the whole page. |
| 7 | |
| 8 | ## Syntax |
| 9 | |
| 10 | ```http |
| 11 | HX-Request-Type: partial |
| 12 | |
| 13 | // or |
| 14 | |
| 15 | HX-Request-Type: full |
| 16 | ``` |
| 17 | |
| 18 | ## Values |
| 19 | |
| 20 | This header is added automatically. |
| 21 | |
| 22 | ### `full` |
| 23 | |
| 24 | Used when the [target](/docs#hypermedia-controls) is the document body, or when selecting elements from the response (with [`hx-select`](/reference/attributes/hx-select)). |
| 25 | |
| 26 | ```html |
| 27 | <!-- If target is body (explicit) --> |
| 28 | <button hx-get=... hx-target="body"> |
| 29 | |
| 30 | <!-- If target is body (implicit) --> |
| 31 | <a href=... hx-boost="true"> |
| 32 | |
| 33 | <!-- If selecting elements from response --> |
| 34 | <div hx-get=... hx-select=".content"> |
| 35 | ``` |
| 36 | |
| 37 | **Note:** [`hx-boost="true"`](/reference/attributes/hx-boost) implicitly sets [`hx-target="body"`](/reference/attributes/hx-target). |
| 38 | |
| 39 | ### `partial` |
| 40 | |
| 41 | Used when the target is any other element. |
| 42 | |
| 43 | ```html |
| 44 | <!-- If target is any element (except body) --> |
| 45 | <button hx-get="..." hx-target="#results">...</button> |
| 46 | |
| 47 | <!-- If target is not set (defaults to this element) --> |
| 48 | <div hx-post="...">...</div> |
| 49 | ``` |
| 50 | |
| 51 | ## Examples |
| 52 | |
| 53 | Use it on the server to customize response behavior: |
| 54 | |
| 55 | ```python |
| 56 | request_type = request.headers.get('HX-Request-Type') |
| 57 | if request_type == 'full': |
| 58 | return render_full_page() |
| 59 | else: |
| 60 | return render_fragment() |
| 61 | ``` |