# test-request Action

Used in [FLAT tests](https://sevenval.gitbook.io/flat/reference/testing) to call the FLAT app under test.

## Syntax

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

All [`request`](https://sevenval.gitbook.io/flat/reference/actions/request) 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`](https://sevenval.gitbook.io/flat/reference/actions/assert)):

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

## See also

* [Testing API Requests](https://sevenval.gitbook.io/flat/cookbook/test-api-request) (cookbook)
* [Testing Upstream Requests](https://sevenval.gitbook.io/flat/cookbook/test-backend) (cookbook)
* [Testing](https://sevenval.gitbook.io/flat/reference/testing) (reference)
