Automatically use the http
or https
function appropriate to the given parameter.
Supports:
get
(http
documentation,https
documentation)request
(http
documentation,https
documentation)
import { get } from 'http-or-https';
get('https://example.com', (response) => {
/* ... */
});
get('http://example.com', (response) => {
/* ... */
});
http-or-https
is authored as an ESM module, and therefore requires Node 12.0 or newer.
Install using NPM or Yarn:
npm install http-or-https
yarn add http-or-https
Copyright 2020 Andrew Duthie
Released under the MIT License. See LICENSE.md.