1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#![forbid(unsafe_code)] //! `impl proptest::Arbitrary for http::{Request,Response,Uri};` //! //! This crate contains the code to generate random-ish `http` objects: //! urls, requests, headers, responses //! //! It is rather simple and straightforward: //! most things are just chosen from a static list //! //! To be useful for your project, you may want to fork it and //! modify the arrays. //! //! Example URL simplification sequence: //! //! ```norust //! * `https://6:%5B%5D%3F%2F%3C%7E%23%6D%21%40%24%25%5E%26%2A%28%29%2B%3D%7D%7C%3A%22%3B%27%2C%3E%7B%20@example.com:8080/foo/bar/?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&` //! * `http://6:%5B%5D%3F%2F%3C%7E%23%6D%21%40%24%25%5E%26%2A%28%29%2B%3D%7D%7C%3A%22%3B%27%2C%3E%7B%20@example.com:8080/foo/bar/?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&` //! * `http://%20:%20@example.com:8080/foo/bar/?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&` //! * `http://%20:%20@example.com:8080/foo?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&` //! * `http://%20:%20@example.com:8080/foo?q=w` //! * `/foo?q=w` //! * `/?q=w ` //! * `/?` //! ``` //! //! Example of a request (I know that header names and values are not congruent): //! //! ```norust //! Request { //! method: DELETE, //! uri: /, //! version: HTTP/1.1, //! headers: { //! "dnt": "keep-alive", //! "host": "999999999999999999999999999999999999999999999999999999", //! "date": "websocket", //! "authorization": "close", //! "upgrade": "%", //! "connection": "deflate", //! "content-type": "Thu, 20 Jun 2019 21:06:20 GMT", //! "cache-control": "\r\n", //! "expires": " ", //! "user-agent": "localhost", //! "content-length": "%", //! "server": "max-age=604800", //! "accept": "_xsrf=2|8bea5404|5ef47a59a0516e67bbd5f86849e28a1c|1553532280", //! "accept-encoding": "text/html", //! "accept-language": "websocket", //! }, //! body: (), //! } //! ``` pub extern crate http; pub extern crate proptest; use proptest::arbitrary::Arbitrary; use proptest::bool::{weighted, BoolValueTree}; use proptest::collection::VecValueTree; use proptest::sample::{Index, IndexValueTree}; use proptest::strategy::{NewTree, Strategy, ValueTree}; use proptest::test_runner::TestRunner; use proptest::tuple::TupleValueTree; pub mod uri; pub use uri::ArbitraryUri; pub mod request; pub use request::{ArbitraryMethod, ArbitraryRequest}; pub mod header; pub use header::{ArbitraryHeaderMap, ArbitraryHeaderName, ArbitraryHeaderValue}; pub mod response; pub use response::{ArbitraryResponse, ArbitraryStatusCode};