Low-level HTTP request with file upload and progress
import request from 'uc-request';
request.send({
url: 'http://localhost/api/user.get',
method: 'get'
}, res => {
console.log(res);
});
Creates the instance of the Request class and sends the requests. Returns the class instance.
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
Aborts the request.
License MIT
© velocityzen