jkyberneees / low-http-server

HTTP Server implementation in top of uWebSocket.js
MIT License
50 stars 7 forks source link

2.1.1 #7

Closed schamberg97 closed 3 years ago

schamberg97 commented 4 years ago
  1. Squashed further aborted bugs (#1 was more persistent, than we thought 😂). My other project, Fyrejet framework uses its own uWebSockets.js compatibility layer that was also based upon 0http's low server. Naturally, I wanted to replace that compatibility layer with low-http-server to maintain less code in the long-term. Unfortunately, express's tests that my other project uses revealed a regression with res.sendFile:
  1) res
       .sendFile(path)
         should not error if the client aborts:
     Uncaught Error: the string "Invalid access of discarded (invalid, deleted) uWS.HttpResponse/SSLHttpResponse." was thrown, throw an Error :)
      at process._fatalException (internal/process/execution.js:165:25)

That means aborted checks that we have here are NOT fully complete. This PR changes that.

  1. Squashed header bugs. Fyrejet also uses some Restana's tests, since its core is based on Restana and it borrows Restana's res.send in certain operating modes. It is also possible this error might occur with unmodified Restana, but I haven't checked it yet. Unfortunately, it appears that sometimes, header contents may include header name. I don't like the fix, but it's the best I could think of.
  1) All Responses
       should GET 200 and html content on /html-string:
     Error: expected "content-type" of "text/html; charset=utf-8", got "content-type,text/html; charset=utf-8"
      at Test._assertHeader (node_modules/supertest/lib/test.js:249:12)
      at Test._assertFunction (node_modules/supertest/lib/test.js:283:11)
      at Test.assert (node_modules/supertest/lib/test.js:173:18)
      at localAssert (node_modules/supertest/lib/test.js:131:12)
      at /Volumes/Work/fyrejet/node_modules/supertest/lib/test.js:128:5
      at Test.Request.callback (node_modules/superagent/lib/node/index.js:716:12)
      at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/index.js:916:18)
      at endReadableNT (_stream_readable.js:1221:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  1. Minor callback changes with facade.close and facade.listen funcs (for convenience).
schamberg97 commented 3 years ago

@jkyberneees