ChemPare Documentation - v0.0.0
    Preparing search index...

    Module helpers/request

    Functions - Suppliers

    isRequest
    fetchDecorator → fetchDecorator
    generateRequestHash → generateRequestHash
    generateSimpleHash → generateSimpleHash

    Functions - Helpers

    getRequestHash

    Generates a unique hash for a given Request object based on its method, URL path, search parameters, and body. This hash can be used to identify and cache requests. This is used to store the mocked response body at a location with a unique filename (based on the hash). This is necessary because the only other way to differentiate between request really is to store the file in a location that contains the hostname, request method, request path and then some way to differentiate between the request body and parameters. But even trying that causes issues. Trying to dynamically import the file ./responses/${reqUrl.hostname}/${reqUrl.path}/${searchQuery}.json throws the exception:

    getCachableResponse

    Creates a cacheable response object from a Request and Response pair. This function serializes the response content based on its content type and generates a hash for the request to be used as a cache key.

    isFullURL

    Checks if a value is a full URL.

    urlencode

    Encodes a string to be used in a URL.

    createDOM

    Converts an HTML string to a DOM Document object.