MCPcopy
hub / github.com/socketio/socket.io / onRequest

Method onRequest

packages/engine.io/lib/transports-uws/polling.ts:51–64  ·  view source on GitHub ↗

* Overrides onRequest. * * @param req * * @private

(req)

Source from the content-addressed store, hash-verified

49 * @private
50 */
51 onRequest(req) {
52 const res = req.res;
53 // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default)
54 req.res = null;
55
56 if (req.getMethod() === "get") {
57 this.onPollRequest(req, res);
58 } else if (req.getMethod() === "post") {
59 this.onDataRequest(req, res);
60 } else {
61 res.writeStatus("500 Internal Server Error");
62 res.end();
63 }
64 }
65
66 /**
67 * The client sends a request awaiting for us to send data.

Callers

nothing calls this directly

Calls 4

onPollRequestMethod · 0.95
onDataRequestMethod · 0.95
writeStatusMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected