node:http
#Import
import http from "nstdlib/node/http";Note
The API is available, but not everything works. Client requests work wherever the host backs the socket bridge. native/ does. The parser is this tree's own and needs no host. http.Server needs listen(), which no host backs yet.
#Support
- nstd: Gives the same output as Node.js in side-by-side tests: http-parser, fetch.
- Browser: Loads with a minimal
processobject. 21 of Node's 21 exports are available. 1 of 1 behavior checks match Node.js.
#Exports (21)
Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:
- ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
- ⚠️ A value one way,
undefinedthe other. - ❔
undefinedboth ways. - ❌ Not exported at all.
- – Not measured.
| Export | Node.js | Browser |
|---|---|---|
Agent | ✅ | ✅ |
ClientRequest | ✅ | ✅ |
CloseEvent | ✅ | ✅ |
IncomingMessage | ✅ | ✅ |
METHODS | ✅ | ✅ |
MessageEvent | ✅ | ✅ |
OutgoingMessage | ✅ | ✅ |
STATUS_CODES | ✅ | ✅ |
Server | ✅ | ✅ |
ServerResponse | ✅ | ✅ |
WebSocket | ✅ | ✅ |
_connectionListener | ✅ | ✅ |
createServer | ✅ | ✅ |
get | ✅ | ✅ |
globalAgent | ✅ | ✅ |
maxHeaderSize | ✅ | ✅ |
request | ✅ | ✅ |
setGlobalProxyFromEnv | ✅ | ✅ |
setMaxIdleHTTPParsers | ✅ | ✅ |
validateHeaderName | ✅ | ✅ |
validateHeaderValue | ✅ | ✅ |
#Diagnostics
nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:
coverage: 21/21 of the host's export names answer inside host node. API only. Client requests work wherever the host backs the socket bridge.native/does. The parser is this tree's own and needs no host.http.Serverneedslisten(), which no host backs yet.smoke: Imports in a clean child process.node-suite: 322/409 of Node's own eligible tests pass with ./dist inside host node. A failure there and in the page is the library's, one only in the page is the engine's.