(request, key, val)
| 2110 | __privateMethod(this, _publishUpgradeTrailers, publishUpgradeTrailers_fn).call(this); |
| 2111 | } |
| 2112 | /** |
| 2113 | * @param {Error} error |
| 2114 | */ |
| 2115 | onUpgradeError(error) { |
| 2116 | assert(!this.aborted); |
| 2117 | assert(this.completed); |
| 2118 | if (channels.error.hasSubscribers) { |
| 2119 | channels.error.publish({ request: this, error }); |
| 2120 | } |
| 2121 | } |
| 2122 | onComplete(trailers) { |
| 2123 | this.onFinally(); |
| 2124 | assert(!this.aborted); |
| 2125 | this.completed = true; |
| 2126 | if (channels.trailers.hasSubscribers) { |
| 2127 | channels.trailers.publish({ request: this, trailers }); |
| 2128 | } |
| 2129 | try { |
| 2130 | return this[kHandler].onComplete(trailers); |
| 2131 | } catch (err) { |
| 2132 | this.onError(err); |
| 2133 | } |
| 2134 | } |
| 2135 | onError(error) { |
| 2136 | this.onFinally(); |
| 2137 | if (channels.error.hasSubscribers) { |
| 2138 | channels.error.publish({ request: this, error }); |
| 2139 | } |
| 2140 | if (this.aborted) { |
| 2141 | return; |
| 2142 | } |
| 2143 | this.aborted = true; |
| 2144 | return this[kHandler].onError(error); |
| 2145 | } |
| 2146 | onFinally() { |
| 2147 | if (this.errorHandler) { |
| 2148 | this.body.off("error", this.errorHandler); |
| 2149 | this.errorHandler = null; |
| 2150 | } |
| 2151 | if (this.endHandler) { |
| 2152 | this.body.off("end", this.endHandler); |
| 2153 | this.endHandler = null; |
| 2154 | } |
| 2155 | } |
| 2156 | addHeader(key, value) { |
| 2157 | processHeader(this, key, value); |
| 2158 | return this; |
| 2159 | } |
| 2160 | }; |
| 2161 | _publishUpgradeHeaders = new WeakSet(); |
| 2162 | publishUpgradeHeaders_fn = function(statusCode, headers, statusText) { |
| 2163 | if (channels.headers.hasSubscribers) { |
| 2164 | channels.headers.publish({ request: this, response: { statusCode, headers, statusText } }); |
| 2165 | } |
| 2166 | }; |
| 2167 | _publishUpgradeTrailers = new WeakSet(); |
| 2168 | publishUpgradeTrailers_fn = function() { |
| 2169 | if (channels.trailers.hasSubscribers) { |
no test coverage detected