good-request

1.2.0 • Public • Published

good-request

A highly-simple request package, featuring automatic retries if a request fails. Based on the 2020-07-31 example documented at https://nodejs.org/api/http.html#http_http_request_options_callback .

Versions

  • 1.2.0, 2020-09-15, AMV : Added good-string-sort...
  • 1.1.0, 2020-09-15, AMV : I added more, yet to document...
  • 1.0.1, 2020-08-17, AMV : First publish.

Usage

const goodRequest = require('good-request');
// Functions provided:
goodRequest.basicPost         (urlString, ct,  reqText,               callback)
goodRequest.retryingPost      (urlString, ct,  reqText,    nRetries,  callback)
goodRequest.retryingJsonPost  (urlString,      reqObject,  nRetries,  callback)

callback provides an object with some of the following properties:

res.received:       true | undefined
res.statusCode:     response status integer | undefined
res.text:           response body string | undefined
res.error:          error object | undefined
res.errorsRetried:  array of error objects | undefined
res.object:         response body jso | undefined

Better to just peek at the code.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i good-request

      Weekly Downloads

      0

      Version

      1.2.0

      License

      none

      Unpacked Size

      11.2 kB

      Total Files

      3

      Last publish

      Collaborators

      • wv-coder