request.js/examples/postbin.js

16 lines
413 B
JavaScript
Raw Normal View History

2020-04-29 04:43:27 +00:00
'use strict';
var request = require('../');
request({
url: 'https://postb.in/1588134650162-6019286897499?hello=world'
2020-04-29 05:00:26 +00:00
//headers: { 'user-agent': false } // remove
//headers: { 'user-agent': 'test/1.0' } // overwrite
2020-04-29 05:14:50 +00:00
//userAgent: 'test/1.1' // add to the default
2020-04-29 04:43:27 +00:00
})
2021-01-14 23:07:48 +00:00
.then(function (resp) {
2020-04-29 04:43:27 +00:00
console.log(resp.body);
})
2021-01-14 23:07:48 +00:00
.catch(function (err) {
2020-04-29 04:43:27 +00:00
console.error(err);
});