HTTP Client and Server
Provides an API to make HTTP requests and host HTTP servers. HTTPS is supported. There are plans to support WebSockets.
Makes a GET request and returns the response body text if successful. Returns false if there was a connection error, timeout error (30 secs), or the response code is 5xx. Advanced: cs.http.request
Makes a POST request and returns the response body text if successful. Returns false if there was a connection error, timeout error (30 secs), or the response code is 5xx. Advanced: cs.http.request
Returns Response object if request was successful. Throws exception if there was a connection or protocol error.
Starts a HTTP server and returns the handle.
Starts a HTTPS server and returns the handle.
The response object holds the data received from making a HTTP request.
Provides an interface to the underlying server handle.
Sets the handler for receiving requests.
Request the server to close. It will gracefully shutdown in the background.
Requests the server to close. The promise will resolve when it's done.
Provides an interface to the current response writer.
Sends UTF-8 text to the response.
Sends raw bytes to the response.
Holds data about the request when hosting an HTTP server.