

Options extend the options of the native http.request. If the first argument is a function ( createClientRequest), it must be a synchronous function that returns a native ClientRequest, such as the one you get from http.request.

If the first argument is a string or URL, it is the url parameter, as in the native http.request(url). (Hattip will not try to support streams, because generically supporting both Promises-with-retries and streams requires more complexity than Hattip wants.) API (3) Promises, retries, and timeouts seem to be the most important generic features for interservice clients. (2) Timeouts and timing measurements are natural partners.

Hattip bundles together the features above because: (1) Promises and retries are natural partners. If you want more complex features, you can use a more complex client library. Hattip will not try to support other fancy HTTP client features unless they're shown to be critically entangled with those above. Auto-parsed JSON request and response bodies (a trivial perk).Timing measurements, to help you understand your request lifecycle and decide what timeouts to use.All the options available to http.request, including the meta-option to use http.request yourself, directly, and give Hattip the ClientRequest.A simple API that makes (and keeps) Promises.What are the most important rules of interservice network etiquette? Use retries and timeouts. Hattip is a promise-based HTTP client for Node.js that makes it easy to follow the most important rules of interservice network etiquette while remaining simple and direct.
