Skip to content

Commit

Permalink
Fixed breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nsn0w committed Jun 10, 2019
1 parent 60610ba commit 73eae92
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The middleware adds the `ctx.ws()` function whenever it detects an upgrade reque
- No magic. This is a middleware, it doesn't turn your Koa app into a KoaMagicWebSocketServer. It knows its place.
- Integrates [ws][ws], one of the fastest and most popular websocket libraries.
- Full composability. Since this is just a middleware, it's not picky on what other libraries you use.
- Minimal, unopinionated 47 SLOC codebase. Seriously, this readme alone contains more code than what's imported into your project. (sorry about the tests though)
- Minimal, unopinionated 40 SLOC codebase. Seriously, this readme alone contains more code than what's imported into your project. (sorry about the tests though)
- Two dependencies only, and it's the ws library and [debug][debug] (because apparently logs are not a bad idea). No need for more clutter in your node_modules.

# Examples and advanced configuration
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ function createWebsocketMiddleware (propertyName = 'ws', options) {

if (~upgradeHeader.indexOf('websocket')) {
debug(`websocket middleware in use on route ${ctx.path}`)
ctx[propertyName] = new Promise((resolve) => {
ctx[propertyName] = () => new Promise((resolve) => {
wss.handleUpgrade(ctx.req, ctx.request.socket, Buffer.alloc(0), resolve)
ctx.respond = false
}
})
}

await next()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koa-easy-ws",
"version": "1.1.2",
"version": "1.1.3",
"description": "Simple Koa middleware for websocket handling",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 73eae92

Please sign in to comment.