Simple and advanced HTTP client for the browser and node.js
url
// smart joining url // replacing object keys by values // appending url, useful with builders GET // -> Promise ;
baseURL
GET // -> Promise ;
header
GET // => Promise ;
param
// use URLSearchParams instance instead of plain object GET // -> Promise;
data
dataFormData // <--- notice this... data'key0' 'value0' data key1: 'value1' key2: 'value2' key3: 'value3' data key4: 'value4' data'key5' 'value5' data'hello' 123 // hello[] = 1, hello[] = 2, hello[]=3 POST // => Promise ;
method
// get, post, put, delete, head, options, patch, fetch, requestmethod'get' FETCH // => Promise;
cancel
// building..let req = // fetching.. req // => FETCH // => Promise ; // canceling... req;
delay
// delay sending the request 1000 ms FETCH // => Promise;
debounce
let fetcher = // debounce time 1000ms fetcherFETCH // => Promise; fetcherFETCH // => Promise; fetcherFETCH // => Promise; fetcherFETCH // => Promise; /** error1:debounced error2:debounced error3:debounced res4: **/
alias
// <-- setting the aliasid1 FETCH // => Promise;
build
let fax; FETCH // => Promise
builders.add build
faxiosbuilders; FETCH // => Promise ;
listeners
let l = consolelog data'key1' 'value1' // before sending // on 200, 201, ..... etc // only on error // after finishing the request // before and after finishing the request //status matches 1[0-9][0-9] // status matches 2[0-9][0-9] // status matches 5[0-9][0-9] // status matches 4[0-9][0-9] //status matches 5[0-9][0-9] // status equal to 400 // status equal to 401 // status equal to 403 // status equal to 404 // status equal to 500 // status equal to 502 // status equal to 503 // status equal to 504 // or // regex FETCH