#matcher #wiremock #requests #test-framework #http #dealing

wiremock-multipart

用于处理多部分请求的 wiremock 匹配器库

2 个版本 (1 个稳定版)

新增 1.0.0 2024 年 8 月 9 日
0.1.0 2022 年 1 月 4 日

#154测试

Download history 280/week @ 2024-04-24 235/week @ 2024-05-01 198/week @ 2024-05-08 151/week @ 2024-05-15 219/week @ 2024-05-22 231/week @ 2024-05-29 239/week @ 2024-06-05 224/week @ 2024-06-12 134/week @ 2024-06-19 214/week @ 2024-06-26 131/week @ 2024-07-03 190/week @ 2024-07-10 141/week @ 2024-07-17 125/week @ 2024-07-24 160/week @ 2024-07-31 281/week @ 2024-08-07

每月 726 次下载
用于 fhttp-core

MIT 许可证

31KB
802

wiremock-multipart

本项目为出色的 wiremock 测试框架提供处理多部分请求的匹配器。

如何安装

wiremock-multipart 添加到您的开发依赖中

[dev-dependencies]
# ...
wiremock-multipart = "0.1"

如果您正在使用 cargo-edit,请运行

cargo add wiremock-multipart --dev

入门指南

use wiremock::{MockServer, Mock, ResponseTemplate};
use wiremock::matchers::method;
use wiremock_multipart::prelude::*;

#[async_std::main]
async fn main() {
    // Start a background HTTP server on a random local port
    let mock_server = MockServer::start().await;

    // Arrange the behaviour of the MockServer adding a Mock
    Mock::given(method("POST"))
        .and(NumberOfParts(2))
        .respond_with(ResponseTemplate::new(200))
        // Mounting the mock on the mock server - it's now effective!
        .mount(&mock_server)
        .await;

    // if we now send a multipart/form-data request with two parts to it, the request
    // will match and return 200.
}

依赖项

~12–23MB
~348K SLoC