LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
607 stars 69 forks source link

Possible misconception in documentation #131

Closed ghashy closed 4 months ago

ghashy commented 9 months ago

In the documentation of the Mock type, there are some mentions of the "surf" namespace. However, I couldn't find any information about "surf" in the documentation. Could you please clarify if "surf" is a specific module or library that is being referred to? And there are registered "GET" mock, and unregistered "GET" mock, but at the bottom of the code block there are "post" method:

let mock = Mock::given(method("GET")).respond_with(response.clone());
    // Registering the mock with the mock server - it's now effective!
    mock_server.register(mock).await;

    // We won't register this mock instead.
    let unregistered_mock = Mock::given(method("GET")).respond_with(response);

// This would have matched `unregistered_mock`, but we haven't registered it!
 // Hence it returns a 404, the default response when no mocks matched on the mock server.
    let status = surf::post(&mock_server.uri())
        .await
        .unwrap()
        .status();

Reference to code: https://github.com/LukeMathWalker/wiremock-rs/blob/443a5850003d2a8f98e14638b513a1ce618214b6/src/mock.rs#L174

LukeMathWalker commented 9 months ago

surf is an HTTP client—just like reqwest and ureq. wiremock doesn't bundle an HTTP client, therefore examples have to use an external one to showcase how the library works in a "typical" scenario.