Make a HTTP Call

Through this library it is possible to make HTTP and HTTPS calls. Here is an example:

const request = require('linkapi-sdk/utils/request');

const options = {
  method: 'GET', // 'POST' | 'PUT' | 'PATCH | 'DELETE'
  url: 'https://api.com.br',
  queryString: {
    page: 2
  },
  headers: {
    key: 'value'
  },
  body: {
    some: 'data'
  },
  timeout: 240000, // default timeout in milliseconds
  form: {
    some: 'data' // form url encoded data
  },
  encoding: '',
  failOnStatusError: true  // default: true - generate an exception when status code >= 300
};

const response = await request(options);