-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add bindings to Incoming/OutgoingMessage * Add bindings to ClientRequest & ServerResponse * Add bindings to Server * Implement bindings to `https` * Remove old bindings * Make tests compile and pass again * Add docs * Update url to 7.0.0 * Expose URL-variant of request/get * Add changelog entry * Update CI actions/node; add purs-tidy
- Loading branch information
1 parent
cfd1a28
commit bdc4a82
Showing
24 changed files
with
1,270 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,20 @@ | ||
import http from "http"; | ||
import http from "node:http"; | ||
|
||
export function createServer(handleRequest) { | ||
return function () { | ||
return http.createServer(function (req, res) { | ||
handleRequest(req)(res)(); | ||
}); | ||
}; | ||
} | ||
export const createServer = () => http.createServer(); | ||
export const createServerOptsImpl = (opts) => http.createServer(opts); | ||
|
||
export function listenImpl(server) { | ||
return function (port) { | ||
return function (hostname) { | ||
return function (backlog) { | ||
return function (done) { | ||
return function () { | ||
if (backlog !== null) { | ||
server.listen(port, hostname, backlog, done); | ||
} else { | ||
server.listen(port, hostname, done); | ||
} | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} | ||
export const maxHeaderSize = http.maxHeaderSize; | ||
|
||
export function closeImpl(server) { | ||
return function (done) { | ||
return function () { | ||
server.close(done); | ||
}; | ||
}; | ||
} | ||
export const requestStrImpl = (url) => http.request(url); | ||
export const requestStrOptsImpl = (url, opts) => http.request(url, opts); | ||
export const requestUrlImpl = (url) => http.request(url); | ||
export const requestUrlOptsImpl = (url, opts) => http.request(url, opts); | ||
export const requestOptsImpl = (opts) => http.request(opts); | ||
|
||
export function listenSocket(server) { | ||
return function (path) { | ||
return function (done) { | ||
return function () { | ||
server.listen(path, done); | ||
}; | ||
}; | ||
}; | ||
} | ||
export const getStrImpl = (url) => http.get(url); | ||
export const getStrOptsImpl = (url, opts) => http.get(url, opts); | ||
export const getUrlImpl = (url) => http.get(url); | ||
export const getUrlOptsImpl = (url, opts) => http.get(url, opts); | ||
export const getOptsImpl = (opts) => http.get(opts); | ||
|
||
export function onConnect(server) { | ||
return function (cb) { | ||
return function () { | ||
server.on("connect", function (req, socket, buffer) { | ||
return cb(req)(socket)(buffer)(); | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function onUpgrade(server) { | ||
return function (cb) { | ||
return function () { | ||
server.on("upgrade", function (req, socket, buffer) { | ||
return cb(req)(socket)(buffer)(); | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function setHeader(res) { | ||
return function (key) { | ||
return function (value) { | ||
return function () { | ||
res.setHeader(key, value); | ||
}; | ||
}; | ||
}; | ||
} | ||
|
||
export function setHeaders(res) { | ||
return function (key) { | ||
return function (values) { | ||
return function () { | ||
res.setHeader(key, values); | ||
}; | ||
}; | ||
}; | ||
} | ||
|
||
export function setStatusCode(res) { | ||
return function (code) { | ||
return function () { | ||
res.statusCode = code; | ||
}; | ||
}; | ||
} | ||
|
||
export function setStatusMessage(res) { | ||
return function (message) { | ||
return function () { | ||
res.statusMessage = message; | ||
}; | ||
}; | ||
} | ||
export const setMaxIdleHttpParsersImpl = (i) => http.setMaxIdleHTTPParsers(i); |
Oops, something went wrong.