lipanski / mockito

HTTP mocking for Rust!
MIT License
695 stars 59 forks source link

WebSocket support #33

Open cpick opened 6 years ago

cpick commented 6 years ago

I've been using Mockito to test my RESTy client code and I've recently started using some WebSocket endpoints as well.

Is there any interest in/has there been any thought about adding WebSocket mocking to Mockito?

If there is interest, I may be able to spend some time on it.

lipanski commented 6 years ago

hi @cpick

I think this crate could include websocket support as long as it doesn't complicate things. the http_muncher crate that I use to parse http has some websocket support afaik (it's based on the node http parser).

PRs are welcome :cake:

sterlingjensen commented 6 years ago

I need this as well, but before I get into it implementing it - how open is the project to a dependency on http and maybe websocket? I ask because that would change the center of gravity on this project from: a 'nothing up your sleeves' barebone http server plus test harness, to: just a test harness. That would be bad for a learning project, but good for a production crate. Is that ok with you @lipanski? I'd be happy to give it a go, so long as I can avoid dragging in futures.

lipanski commented 6 years ago

@sterlingjensen is there any way to allow mocking websockets without pulling in big dependencies? I'd prefer that, even if writing websocket tests would be a bit more verbose than without the extra dependencies. websockets are not such a common test scenario so I'd rather not have everyone depend on additional crates because of that (or at least not on big crates).

sterlingjensen commented 6 years ago

@lipanski not without writing a websocket server and client. I've been working on a greenfield implementation, because you're right - it wouldn't make sense to pull in a dependency that reimplements so much existing functionality.

vasilakisfil commented 4 years ago

I would also need support for websockets :/ Websockets are becoming more and more common..

@lipanski I think it's fine as long as the websocket support is put under a feature flag ? So that you don't pull in all dependencies if you want to mock just http requests.

ghost commented 4 years ago

Any libraries that can be used while this get implemented in mockito?