eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
753 stars 133 forks source link

Support Koa #171

Closed RWOverdijk closed 5 years ago

RWOverdijk commented 5 years ago

Hey! Cool module.

I've been playing with it for a bit for my koa-based app and it works, with the exception of query which needs to just be part of the url. Funny enough I don't see any mention of koa in this project.

In case you just never tested it, I thought I'd let you know so you can document it (and perhaps attract more contributors that way?).

The only question I have, is if it would be weird to use this module in production. I'm looking into allowing calls to routes using websockets. For this purpose I need to mock requests so they go through the middleware like any other request would. Should I use this module for that? It works, but you probably know best because you built it :D

eugef commented 5 years ago

Thanks for giving a tip about Koa, i will update the readme.

This module is intended to be used for testing purposes, for production i would suggest to find a more light-weight solution.

RWOverdijk commented 5 years ago

Cool. I'll fold my own then :) It's simply a matter of treating the websocket event as an http request so that shouldn't be too difficult.