Skip to content

Commit

Permalink
get get_data.js working
Browse files Browse the repository at this point in the history
  • Loading branch information
satyarohith committed Sep 24, 2024
1 parent 3261473 commit e98525c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ext/node/polyfills/_http_outgoing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ Object.defineProperties(
_flushHeaders() {
console.log("flushHeaders");
if (this.socket) {
if (!this._headerSent && this._header !== null) {
console.log("socket found: ", { headerSent: this._headerSent, header: this._header });
if (!this._headerSent) {
console.log("_writeHeader invoked");
this._writeHeader();
this._headerSent = true;
}
Expand Down
11 changes: 7 additions & 4 deletions ext/node/polyfills/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ class ClientRequest extends OutgoingMessage {
}
}

const client = this._getClient() ?? createHttpClient({ http2: false });
this._client = client;
console.log({ headers });
// const client = this._getClient() ?? createHttpClient({ http2: false });
// this._client = client;

if (
this.method === "POST" || this.method === "PATCH" || this.method === "PUT"
Expand Down Expand Up @@ -476,15 +477,16 @@ class ClientRequest extends OutgoingMessage {
await op_node_http_wait_for_connection(connRid);
this.emit("requestReady");
const res = await op_node_http_await_response(rid);
console.log({ res });
console.log({ status: res.status });
// if (this._req.cancelHandleRid !== null) {
// core.tryClose(this._req.cancelHandleRid);
// }
// if (this._timeout) {
// this._timeout.removeEventListener("abort", this._timeoutCb);
// webClearTimeout(this._timeout[timerId]);
// }
this._client.close();
// this._client.close();
console.log("IncomingMessageForClient constructed");
const incoming = new IncomingMessageForClient(this.socket);
incoming.req = this;
this.res = incoming;
Expand Down Expand Up @@ -554,6 +556,7 @@ class ClientRequest extends OutgoingMessage {
this._closed = true;
this.emit("close");
} else {
console.log("emitting response");
{
console.log("_bodyRid set", res.responseRid);
incoming._bodyRid = res.responseRid;
Expand Down

0 comments on commit e98525c

Please sign in to comment.