qiao-request
v3.2.0
Published
nodejs http request client
Downloads
8
Maintainers
Readme
qiao-request
api
getSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://www.baidu.com';
var res = await q.getSync({
url: url,
qs: {
test: 'test',
},
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
postSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://www.baidu.com';
var res = await q.postSync({
url: url,
qs: {
test: 'test',
},
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
putSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://10.33.12.68:8002/put';
var res = await q.putSync({
url: url,
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
patchSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://10.33.12.68:8002/patch';
var res = await q.patchSync({
url: url,
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
deleteSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://10.33.12.68:8002/delete';
var res = await q.deleteSync({
url: url,
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
headSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://10.33.12.68:8002/head';
var res = await q.headSync({
url: url,
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
optionsSync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'http://10.33.12.68:8002/options';
var res = await q.optionsSync({
url: url,
});
console.log(res);
} catch (e) {
console.log(e);
}
};
test();
get
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://www.baidu.com';
q.get(
{
url: url,
qs: {
test: 'test',
},
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
post
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://www.baidu.com';
q.post(
{
url: url,
qs: {
test: 'test',
},
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
put
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://10.33.12.68:8002/put';
q.put(
{
url: url,
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
patch
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://10.33.12.68:8002/patch';
q.patch(
{
url: url,
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
delete
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://10.33.12.68:8002/delete';
q.delete(
{
url: url,
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
head
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://10.33.12.68:8002/head';
q.head(
{
url: url,
},
function (err, rs, body) {
console.log(err, rs.headers);
},
);
};
test();
options
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'http://10.33.12.68:8002/options';
q.options(
{
url: url,
},
function (err, rs, body) {
console.log(err, body);
},
);
};
test();
download
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'https://www.baidu.com/img/bd_logo1.png';
var path = 'd:/test.png';
await q.download(url, path);
} catch (e) {
console.log(e);
}
};
test();
imgToBase64
'use strict';
var q = require('qiao-request');
var test = function () {
var url = 'https://www.baidu.com/img/[email protected]';
q.imgToBase64(url, function (res) {
console.log(res);
});
};
test();
imgToBase64Sync
'use strict';
var q = require('qiao-request');
var test = async function () {
try {
var url = 'https://www.baidu.com/img/[email protected]';
var res = await q.imgToBase64Sync(url);
console.log(res);
} catch (e) {
console.log(e);
}
};
test();