JSPM

good-request

1.2.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 4
    • Score
      100M100P100Q26645F

    A highly-simple request package, featuring automatic retries if a request fails.

    Package Exports

    • good-request

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (good-request) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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.