An open API service indexing awesome lists of open source software.

https://github.com/usagi-flow/iron-test

A test helper crate for Iron.
https://github.com/usagi-flow/iron-test

http iron rust rust-crate testing

Last synced: 6 months ago
JSON representation

A test helper crate for Iron.

Awesome Lists containing this project

README

          

iron-test
=========

_A test helper crate for [Iron](https://github.com/iron/iron)._

This crate provides the ``request_get()`` and ``request_post()`` functions to easily test Iron handlers without firing up a local HTTP server.

Invoke the functions by passing an Iron chain (``iron::middleware::Chain``) and - in the case of a POST request - a ``&str`` containing the body payload.

```
#[test]
fn test_hello_get()
{
let iron = IronServer::new().create_iron();
let response = request_get(&iron, "/hello").unwrap();

assert!(response.status.unwrap().is_client_error());
}
```