mockhttp
mockhttp copied to clipboard
requestExpectations queue not thread safe
Hello Richard Szalay,
first of all, thank you very much for this very helpfull library. One thing I have found on using it - if you use expectations with multithreaded application, then the queue requestExpectations in MockHttpMessageHandler.cs (line 16) sometimes becomes negative valued, because it is not thread safe. Maybe its a good idea to use your lock object to lock the queue or to use the ConcurrentQueue.
Thank you very much
Great idea @ddizik. I might look at including this the next time I update the library. Alternatively, if you're happy to submit a PR - feel free!
I'm going to close this issue as it's not something I currently require. I will happy accept a PR from the community, though, if it is causing anyone problems (as long as it comes with tests and doesn't cause compat issues).