1.1.5 • Published 3 years ago

ecrequest v1.1.5

Weekly downloads
45
License
MIT
Repository
github
Last release
3 years ago

ecRequest

An easy way to request http and https

Install

npm install ecrequest

Use

const ecrequest = require('ecrequest');
const opt = {
  protocol: 'https:',
  host: 'www.google.com',
  port: 80,
  hostname: 'www.google.com',
  pathname: '/',
  path: '/' };

### request ###
ecrequest.request(opt).then(console.log);

### get ###
ecrequest.get(opt).then(console.log);

### post ###
opt.data = { post: 'body' };
ecrequest.post(opt).then(console.log);

### put ###
opt.data = { put: 'body' };
ecrequest.put(opt).then(console.log);

### delete ###
opt.headers = { 'content-type': 'application/json' };
ecrequest.delete(opt).then(console.log);