Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,8 @@ | ||
## [1.0.3](https://github.com/Safe-Security/praxios/compare/v1.0.2...v1.0.3) (2021-10-01) | ||
### Bug Fixes | ||
* move tunnel types to dependencies ([#9](https://github.com/Safe-Security/praxios/issues/9)) ([5a17491](https://github.com/Safe-Security/praxios/commit/5a1749124a8dc01ceb94b1a33e42f476d476455b)), closes [#8](https://github.com/Safe-Security/praxios/issues/8) | ||
## [1.0.2](https://github.com/Safe-Security/praxios/compare/v1.0.1...v1.0.2) (2021-09-30) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "praxios", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "wrapper to support corporate proxies in axios", | ||
@@ -12,3 +12,4 @@ "main": "dist/index.js", | ||
"axios": "^0.21.4", | ||
"tunnel": "^0.0.6" | ||
"tunnel": "^0.0.6", | ||
"@types/tunnel": "^0.0.3" | ||
}, | ||
@@ -21,3 +22,2 @@ "devDependencies": { | ||
"@types/jest": "^27.0.2", | ||
"@types/tunnel": "^0.0.3", | ||
"husky": "^7.0.2", | ||
@@ -24,0 +24,0 @@ "jest": "^27.2.3", |
112
README.md
@@ -1,1 +0,111 @@ | ||
# praxios | ||
# praxios<!-- omit in toc --> | ||
![npm](https://img.shields.io/npm/v/praxios) | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/safe-security/praxios/Release) | ||
A wrapper over the axios library to support corporate proxies well | ||
## Table of Contents<!-- omit in toc --> | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Proxy without authentication](#proxy-without-authentication) | ||
- [Proxy with authentication](#proxy-with-authentication) | ||
- [Bypass proxy for hosts](#bypass-proxy-for-hosts) | ||
- [Customizing the axios settings or using without proxy](#customizing-the-axios-settings-or-using-without-proxy) | ||
- [Resources](#resources) | ||
- [Credits](#credits) | ||
- [License](#license) | ||
## Installation | ||
npm: | ||
```shell | ||
npm install praxios | ||
``` | ||
yarn: | ||
```shell | ||
yarn add praxios | ||
``` | ||
## Usage | ||
### Proxy without authentication | ||
```typescript | ||
//proxy.js | ||
import praxios from "praxios"; | ||
proxios | ||
.get("/dummy") | ||
.then(response => { | ||
console.log(response.data); | ||
}) | ||
.catch(error => { | ||
console.log(error); | ||
}); | ||
``` | ||
```shell | ||
export PROXY_HOST="my-corporate-proxy.local" | ||
export PROXY_PORT="3128" | ||
node proxy.js | ||
``` | ||
#### Proxy with authentication | ||
```shell | ||
export PROXY_HOST="my-corporate-proxy.local" | ||
export PROXY_PORT="3128" | ||
export PROXY_USERNAME="foo" | ||
export PROXY_PASSWORD="bar" | ||
node proxy.js | ||
``` | ||
### Bypass proxy for hosts | ||
```shell | ||
export PROXY_HOST="my-corporate-proxy.local" | ||
export PROXY_PORT="3128" | ||
export NO_PROXY="host1.domain,host2.domain,1.2.3.4" | ||
node proxy.js | ||
``` | ||
### Customizing the axios settings or using without proxy | ||
The library also exposes the built-in axios library for any advanced configuration or customization | ||
```typescript | ||
//custom.js | ||
import { baseAxios } from "praxios"; | ||
const axios = baseAxios.create({ | ||
httpsAgent: {}, | ||
baseUrl: "", | ||
}); | ||
axios | ||
.get("/dummy") | ||
.then(response => { | ||
console.log(response.data); | ||
}) | ||
.catch(error => { | ||
console.log(error); | ||
}); | ||
``` | ||
## Resources | ||
- [axios](https://github.com/axios/axios/) | ||
- [tunnel](https://github.com/koichik/node-tunnel) | ||
## Credits | ||
`praxios` was mostly inspired out of the great work and research done by [Jan Molak](https://github.com/jan-molak/) documented very well on this blog post: [Node.js Axios behind corporate proxies](https://janmolak.com/node-js-axios-behind-corporate-proxies-8b17a6f31f9d) | ||
## License | ||
[MIT](LICENSE) |
6792
9
112
3
6
+ Added@types/tunnel@^0.0.3
+ Added@types/node@22.13.4(transitive)
+ Added@types/tunnel@0.0.3(transitive)
+ Addedundici-types@6.20.0(transitive)