Documentation ¶
Overview ¶
Package httpx provides generic functions which extend the capabilities of the http package.
The code here eliminates an annoying race condition in net/http that prevents you from knowing when it is safe to connect to the server socket. For the functions in this package, the listening socket is fully estabished when the function returns, and it is safe to run an HTTP GET immediately.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServeAsync ¶
ListenAndServeAsync starts an http server. The server will run until Shutdown() or Close() is called, but this function will return once the listening socket is established. This means that when this function returns, the server is immediately available for an http GET to be run against it.
Returns a non-nil error if the listening socket can't be established. Logs a fatal error if the server dies for a reason besides ErrServerClosed. If the server.Addr is set to :0, then after this function returns server.Addr will contain the address and port which this server is listening on.
func ListenAndServeTLSAsync ¶
ListenAndServeTLSAsync starts an https server. The server will run until Shutdown() or Close() is called, but this function will return once the listening socket is established. This means that when this function returns, the server is immediately available for an https GET to be run against it.
Returns a non-nil error if the listening socket can't be established. Logs a fatal error if the server dies for a reason besides ErrServerClosed.
Types ¶
This section is empty.