Skip to content

Commit

Permalink
alternate approach
Browse files Browse the repository at this point in the history
  • Loading branch information
paperdave committed Aug 29, 2023
1 parent 2a0a8a5 commit a713a86
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions src/js/node/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,6 @@ class IncomingMessage extends Readable {
this.url = url.pathname + url.search;
this.#nodeReq = this.req = nodeReq;
assignHeaders(this, req);

this.statusCode = req.status;
this.statusMessage = STATUS_CODES[req.status];

this.httpVersion = "1.1";
this.httpVersionMajor = 1;
this.httpVersionMinor = 1;

this.rawTrailers = [];
this.trailers = kEmptyObject;
}

headers;
Expand Down Expand Up @@ -686,6 +676,48 @@ class IncomingMessage extends Readable {
return this.#fakeSocket;
}

get statusCode() {
return this.#req.status;
}

set statusCode(val) {}

get statusMessage() {
return STATUS_CODES[this.#req.status];
}

set statusMessage(val) {}

get httpVersion() {
return "1.1";
}

set httpVersion(val) {}

get rawTrailers() {
return [];
}

set rawTrailers(val) {}

get httpVersionMajor() {
return 1;
}

set httpVersionMajor(val) {}

get httpVersionMinor() {
return 1;
}

set httpVersionMinor(val) {}

get trailers() {
return kEmptyObject;
}

set trailers(val) {}

get socket() {
return (this.#fakeSocket ??= new FakeSocket());
}
Expand Down

0 comments on commit a713a86

Please sign in to comment.