> For the complete documentation index, see [llms.txt](https://sevenval.gitbook.io/flat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sevenval.gitbook.io/flat/develop/reference/actions/test-request.md).

# test-request Action

Used in [FLAT tests](/flat/develop/reference/testing.md) to call the FLAT app under test.

## Syntax

```markup
<test-request>
{
  "path": "/api/path"
}
</test-request>
```

All [`request`](/flat/develop/reference/actions/request.md) parameters and options can be used:

```markup
<test-request>
{
  "path": "/api/path",
  "method": "POST",
  "headers": {
    "X-Foo": "bar"
  },
  "body": {
    "value": {
      "user": "alice"
    }
  }
}
</test-request>
```

The `test-request` sets these variables to inspect the result (with [`assert`](/flat/develop/reference/actions/assert.md)):

* `$status` the HTTP status code (number)
* `$response` the response body (string)
* `$headers` the response headers (array)

## See also

* [Testing API Requests](/flat/develop/cookbook/test-api-request.md) (cookbook)
* [Testing Upstream Requests](/flat/develop/cookbook/test-backend.md) (cookbook)
* [Testing](/flat/develop/reference/testing.md) (reference)
