Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Latest commit

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Unchained UI

Request

NPM VersionNPM Downloads

Low-level HTTP request with file upload and progress

Usage

importrequestfrom'uc-request';request.send({url: 'http://localhost/api/user.get',method: 'get'},res=>{console.log(res);});

Static methods

send(options, callback)

Creates the instance of the Request class and sends the requests. Returns the class instance.

Methods

send(options, callback)

Sends the request and calls callback.

options are:

  • url – string, URL
  • method – string, http method
  • headers – object, http headers
  • body – various, http request body
  • options – object, any other properties to set on XMLHttpRequest
  • onprogress – function, upload progress handler

callback(result)

  • result
    • status — https request status
    • body — response body. If JSON will be parsed.
    • error — error if request failed

abort()

Aborts the request.

License MIT

© velocityzen

About

Low-level HTTP request with file upload and progress

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages