MCPcopy Create free account
hub / github.com/angular/dev-infra / onMessageComplete

Method onMessageComplete

github-actions/browserstack/set-browserstack-env.js:6382–6427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6380 assert(statusCode >= 200);
6381 if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
6382 util.destroy(socket, new ResponseExceededMaxSizeError());
6383 return -1;
6384 }
6385 this.bytesRead += buf.length;
6386 if (request.onData(buf) === false) {
6387 return constants3.ERROR.PAUSED;
6388 }
6389 }
6390 onMessageComplete() {
6391 const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this;
6392 if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
6393 return -1;
6394 }
6395 if (upgrade) {
6396 return;
6397 }
6398 assert(statusCode >= 100);
6399 assert((this.headers.length & 1) === 0);
6400 const request = client[kQueue][client[kRunningIdx]];
6401 assert(request);
6402 this.statusCode = null;
6403 this.statusText = "";
6404 this.bytesRead = 0;
6405 this.contentLength = "";
6406 this.keepAlive = "";
6407 this.connection = "";
6408 this.headers = [];
6409 this.headersSize = 0;
6410 if (statusCode < 200) {
6411 return;
6412 }
6413 if (request.method !== "HEAD" && contentLength && bytesRead !== parseInt(contentLength, 10)) {
6414 util.destroy(socket, new ResponseContentLengthMismatchError());
6415 return -1;
6416 }
6417 request.onComplete(headers);
6418 client[kQueue][client[kRunningIdx]++] = null;
6419 socket[kSocketUsed] = true;
6420 if (socket[kWriting]) {
6421 assert(client[kRunning] === 0);
6422 util.destroy(socket, new InformationalError("reset"));
6423 return constants3.ERROR.PAUSED;
6424 } else if (!shouldKeepAlive) {
6425 util.destroy(socket, new InformationalError("reset"));
6426 return constants3.ERROR.PAUSED;
6427 } else if (socket[kReset] && client[kRunning] === 0) {
6428 util.destroy(socket, new InformationalError("reset"));
6429 return constants3.ERROR.PAUSED;
6430 } else if (client[kPipelining] == null || client[kPipelining] === 1) {

Callers 1

lazyllhttpFunction · 0.45

Calls 2

destroyMethod · 0.45
onCompleteMethod · 0.45

Tested by

no test coverage detected