@hke/http

Small and easy HTTP request wrapper

Stats

StarsIssuesVersionUpdatedCreatedSize
@hke/http
0.2.74 years ago4 years agoMinified + gzip package size for @hke/http in KB

Readme

HttpService.buildUrl(url: string, query: any = {})

  • Transforms a url plus an object to a callable url
    • @param {string} url A url
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {string}

HttpService.post(url: string, body?: any, query?: any)

  • Does a POST request
    • @param {string} url An url
    • @param {object} body The POST payload object
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {Promise}

HttpService.get(url: string, query?: any)

  • Does a GET request
    • @param {string} url An url
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {Promise}

HttpService.put(url: string, body: any, query?: any)

  • Does a PUT request
    • @param {string} url An url
    • @param {object} body The PUT payload object
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {Promise}

HttpService.delete(url: string, query?: any)

  • Does a DELETE request
    • @param {string} url An url
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {Promise}

HttpService.file(url: string, files: File[], query?: any)

  • Uploads a file
    • @param {string} url An url
    • @param files
    • @param {object} query An object with key value pairs which will be transformed to get parameters
    • @returns {Promise}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.