---
title: "test_request"
url: https://una-lang.org/en/docs/std/testing/test_request/
release: v0.4.0
edition: "0.4, 0.5 preview"
source: https://github.com/una-lang/una/blob/v0.4.0/docs/std/listing.json
---

# test_request

A function of the module `std.testing`, which test code imports ([`spec/14 §4`](https://una-lang.org/en/docs/spec/14-standard-library/#s4)). Edition 0.4, 0.5 preview.

```una
pub test_request(method: Method, target: Text, body: Text) -> Request
  fails TestRequestError
```

A request as the host would read it from a peer (ADR 0123 rule 21, `spec/31 §4`): its target read by the host's own rules, the only header `host: test`, the peer `192.0.2.1` and the listener `test`. Fails with `Refused` where the host would answer `400`. Usable only in examples and in handlers that only examples install (`spec/14 §4`).

## Specification

- [`spec/31 §4`](https://una-lang.org/en/docs/spec/31-http-servers/4-the-target/#s4)
- [`spec/14 §4`](https://una-lang.org/en/docs/spec/14-standard-library/#s4)

Generated from the standard modules of una v0.4.0 ([`docs/std/listing.json`](https://github.com/una-lang/una/blob/5fec93d88932b333feec25e589355a2cb34c37b5/docs/std/listing.json), which is not part of the specification). The specification governs: [`spec/14 §1`](https://una-lang.org/en/docs/spec/14-standard-library/#s1).
