https://github.com/aduth/http-or-https
Automatically use the http or https function appropriate to the given parameter
https://github.com/aduth/http-or-https
Last synced: 8 months ago
JSON representation
Automatically use the http or https function appropriate to the given parameter
- Host: GitHub
- URL: https://github.com/aduth/http-or-https
- Owner: aduth
- License: mit
- Created: 2020-10-18T16:31:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-18T18:23:31.000Z (over 5 years ago)
- Last Synced: 2025-03-13T22:35:06.588Z (over 1 year ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# http-or-https
Automatically use the `http` or `https` function appropriate to the given parameter.
Supports:
- `get` ([`http` documentation](https://nodejs.org/api/http.html#http_http_get_options_callback), [`https` documentation](https://nodejs.org/api/https.html#https_https_get_options_callback))
- `request` ([`http` documentation](https://nodejs.org/api/http.html#http_http_request_options_callback), [`https` documentation](https://nodejs.org/api/https.html#https_https_request_options_callback))
## Example
```js
import { get } from 'http-or-https';
get('https://example.com', (response) => {
/* ... */
});
get('http://example.com', (response) => {
/* ... */
});
```
## Installation
`http-or-https` is authored as an [ESM module](https://nodejs.org/api/esm.html), and therefore requires Node 12.0 or newer.
Install using NPM or Yarn:
```
npm install http-or-https
```
```
yarn add http-or-https
```
## License
Copyright 2020 Andrew Duthie
Released under the MIT License. See [LICENSE.md](./LICENSE.md).