MCPcopy Index your code
hub / github.com/CodeGenieApp/serverless-express / constructor

Method constructor

src/response.js:84–135  ·  view source on GitHub ↗
({ method })

Source from the content-addressed store, hash-verified

82 }
83
84 constructor ({ method }) {
85 super({ method })
86
87 this[BODY] = []
88 this[HEADERS] = {}
89
90 this.useChunkedEncodingByDefault = false
91 this.chunkedEncoding = false
92 this._header = ''
93
94 this.assignSocket({
95 _writableState: {},
96 writable: true,
97 on: Function.prototype,
98 removeListener: Function.prototype,
99 destroy: Function.prototype,
100 cork: Function.prototype,
101 uncork: Function.prototype,
102 write: (data, encoding, cb) => {
103 if (typeof encoding === 'function') {
104 cb = encoding
105 encoding = null
106 }
107
108 if (this._header === '' || this._wroteHeader) {
109 addData(this, data)
110 } else {
111 const string = getString(data)
112 const index = string.indexOf(headerEnd)
113
114 if (index !== -1) {
115 const remainder = string.slice(index + headerEnd.length)
116
117 if (remainder) {
118 addData(this, remainder)
119 }
120
121 this._wroteHeader = true
122 }
123 }
124
125 if (typeof cb === 'function') {
126 cb()
127 }
128
129 // must return bool to indicate if the data was flushed to the
130 // kernel and if not then indicate that the sender must wait
131 // for drain event; which we never do so always return true.
132 return true
133 }
134 })
135 }
136}

Callers

nothing calls this directly

Calls 2

addDataFunction · 0.85
getStringFunction · 0.85

Tested by

no test coverage detected