@hke/http

0.2.7 • Public • Published

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}

Readme

Keywords

none

Package Sidebar

Install

npm i @hke/http

Weekly Downloads

1

Version

0.2.7

License

ISC

Last publish

Collaborators

  • heiko87