LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
631 stars 73 forks source link

adding response headers does not work #26

Closed beltram closed 3 years ago

beltram commented 3 years ago

Hi, first of all congrats for the effort, I like the initiative.
After playing with it I found appending a response headers is not working.

Problem comes from this line. stdlib implementation of HashMap::insert returns None when key is not already present and since unwrap() is used it fails every time. Simply removing unwrap should fix this.

LukeMathWalker commented 3 years ago

Thanks for reporting the issue! It's now fixed in 0.4.0-alpha.2 :grin:

onelson commented 3 years ago

I got the same panic on unwrap, but interestingly my mock wasn't setting headers at all...

        Mock::given(method("POST"))
            .and(path(
                "/api/v1/entity/notes/123456/attachments/_upload/multipart_abort",
            ))
            .respond_with(ResponseTemplate::new(204))
            .expect(1)
            .mount(&mock_server)
            .await;

The good news is, the fix in 0.4.0.alpha.2 worked for me too! :partying_face: