bare-http1 4.5.2 → 4.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ const { isFinishing } = require('bare-stream')
1
2
  const HTTPOutgoingMessage = require('./outgoing-message')
2
3
  const constants = require('./constants')
3
4
 
@@ -15,7 +16,6 @@ module.exports = class HTTPServerResponse extends HTTPOutgoingMessage {
15
16
 
16
17
  this._chunked = true
17
18
  this._close = close
18
- this._finishing = false
19
19
  this._onlyHeaders = req.method === 'HEAD'
20
20
 
21
21
  this._pendingWrite = null
@@ -33,12 +33,6 @@ module.exports = class HTTPServerResponse extends HTTPOutgoingMessage {
33
33
  return this._statusMessage
34
34
  }
35
35
 
36
- end(data) {
37
- this._finishing = true
38
-
39
- return super.end(data)
40
- }
41
-
42
36
  writeHead(statusCode, statusMessage = null, headers = {}) {
43
37
  if (typeof statusMessage === 'object' && statusMessage !== null) {
44
38
  headers = statusMessage
@@ -78,7 +72,7 @@ module.exports = class HTTPServerResponse extends HTTPOutgoingMessage {
78
72
 
79
73
  _write(data, encoding, cb) {
80
74
  if (this._headersSent === false) {
81
- if (this._finishing) {
75
+ if (isFinishing(this)) {
82
76
  this.setHeader(
83
77
  'Content-Length',
84
78
  (data.byteLength + this._writableState.buffered).toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-http1",
3
- "version": "4.5.2",
3
+ "version": "4.5.3",
4
4
  "description": "Native HTTP/1 library for JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "bare-events": "^2.6.0",
40
40
  "bare-http-parser": "^1.1.1",
41
- "bare-stream": "^2.3.0",
41
+ "bare-stream": "^2.10.0",
42
42
  "bare-tcp": "^2.2.0"
43
43
  },
44
44
  "devDependencies": {