Closed
Description
Hey,
I recently ported one of my Go apps to Rust. I was happy to discover wiremock along the way, which has served me very well so far. Thanks! 👏
One feature I do miss from Go's httptest package though is the ability to easily serve all test files contained in a folder, e.g.
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
defer ts.Close()
// pass ts.URL to tests
With wiremock, the best I could come up with was to read files one by one depending on the test:
for td in testdata(&server.uri()).iter() {
let body = fs::read_to_string(format!("dilbert/testdata/strip/{}", td.date)).unwrap();
let resp = ResponseTemplate::new(200).set_body_raw(body, "text/html");
...
However, I didn't like that solution and ended up using include_str
instead.
Maybe there's a simpler way I'm missing here?
Or maybe it's a sensible feature request. 😀
Metadata
Metadata
Assignees
Labels
No labels