1 个不稳定版本
0.1.0 | 2019 年 6 月 13 日 |
---|
#11 in #proptest
用于 http-bytes
23KB
509 行代码(不包括注释)
proptest-http
impl proptest::Arbitraryfor http::{Request,Response,Uri};
此软件包包含生成类似随机 http 对象的代码:URL、请求、头、响应
它相当简单直接:大多数东西都只是从静态列表中选择
为了使它对您的项目有用,您可能需要将其分叉并修改数组。
示例 URL 简化序列
* `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%[email protected]: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%[email protected]:8080/foo/bar/?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&`
* `http://%20:%[email protected]:8080/foo/bar/?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&`
* `http://%20:%[email protected]:8080/foo?q=http%3A%2F%2F%5B%3A%3A1%5D%3A123%2F%3Fqw%3D3%26q%3D1%231v&`
* `http://%20:%[email protected]:8080/foo?q=w`
* `/foo?q=w`
* `/?q=w `
* `/?`
请求示例(我知道头名称和值不一致)
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: (),
}
许可:MIT/Apache-2.0
依赖项
~3MB
~46K SLoC