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.
- Host: GitHub
- URL: https://github.com/usagi-flow/iron-test
- Owner: usagi-flow
- License: gpl-3.0
- Created: 2020-05-09T09:32:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-03T19:17:28.000Z (about 5 years ago)
- Last Synced: 2025-07-29T05:55:21.878Z (8 months ago)
- Topics: http, iron, rust, rust-crate, testing
- Language: Rust
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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());
}
```