Skip to content

Commit 91f34c9

Browse files
committed
4.0.0: add compatibility for axios
1 parent 5cb6d74 commit 91f34c9

38 files changed

+184
-26443
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [12.x, 14.x]
19+
node-version: [20.x, 21.x]
2020

2121
steps:
2222
- uses: actions/checkout@v2

.travis.yml

-7
This file was deleted.

README.md

+10-20
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
> The lightweight Node.js HTTP client
66
7-
[Full documentation](https://ethanent.github.io/phin/global.html) | [GitHub](https://github.com/ethanent/phin) | [NPM](https://www.npmjs.com/package/phin)
8-
97
## Deprecated
108

119
This package is deprecated and should not be used. Please see [#91](https://github.com/ethanent/phin/issues/91) for more information.
@@ -15,7 +13,7 @@ This package is deprecated and should not be used. Please see [#91](https://gith
1513
```javascript
1614
const p = require('phin')
1715

18-
const res = await p('https://ethanent.me')
16+
const res = await p('https://example.com')
1917

2018
console.log(res.body)
2119
```
@@ -42,7 +40,7 @@ Simple POST:
4240

4341
```js
4442
await p({
45-
url: 'https://ethanent.me',
43+
url: 'https://example.com',
4644
method: 'POST',
4745
data: {
4846
hey: 'hi'
@@ -55,7 +53,7 @@ await p({
5553
```js
5654
const p = require('phin').unpromisified
5755

58-
p('https://ethanent.me', (err, res) => {
56+
p('https://example.com', (err, res) => {
5957
if (!err) console.log(res.body)
6058
})
6159
```
@@ -66,7 +64,7 @@ Simple parsing of JSON:
6664
// (In async function in this case.)
6765

6866
const res = await p({
69-
'url': 'https://ethanent.me/name',
67+
'url': 'https://example.com/',
7068
'parse': 'json'
7169
})
7270

@@ -84,33 +82,25 @@ const ppostjson = p.defaults({
8482

8583
// In async function...
8684

87-
const res = await ppostjson('https://ethanent.me/somejson')
85+
const res = await ppostjson('https://example.com/somejson')
8886
// ^ An options object could also be used here to set other options.
8987

9088
// Do things with res.body?
9189
```
9290

93-
### Custom Core HTTP Options
91+
### Custom Axios HTTP Options
9492

95-
Phin allows you to set [core HTTP options](https://nodejs.org/api/http.html#http_http_request_url_options_callback).
93+
Phin allows you to set [Axios HTTP options](https://github.com/axios/axios?tab=readme-ov-file#request-config).
9694

9795
```js
9896
await p({
99-
'url': 'https://ethanent.me/name',
100-
'core': {
101-
'agent': myAgent // Assuming you'd already created myAgent earlier.
97+
'url': 'https://example.com/name',
98+
'axiosOpts': {
99+
httpAgent: myAgent // Assuming you'd already created myAgent earlier.
102100
}
103101
})
104102
```
105103

106-
107-
## Full Documentation
108-
109-
There's a lot more which can be done with the Phin library.
110-
111-
See [the Phin documentation](https://ethanent.github.io/phin/global.html).
112-
113-
114104
## Phin vs. the Competition
115105

116106
Phin is a very lightweight library, yet it contains all of the common HTTP client features included in competing libraries!

SECURITY.md

-5
This file was deleted.

docs/fonts/OpenSans-Bold-webfont.eot

-19.1 KB
Binary file not shown.

docs/fonts/OpenSans-Bold-webfont.svg

-1,830
This file was deleted.

docs/fonts/OpenSans-Bold-webfont.woff

-21.9 KB
Binary file not shown.
-19.7 KB
Binary file not shown.

docs/fonts/OpenSans-BoldItalic-webfont.svg

-1,830
This file was deleted.
-22.5 KB
Binary file not shown.
-19.8 KB
Binary file not shown.

docs/fonts/OpenSans-Italic-webfont.svg

-1,830
This file was deleted.
-22.6 KB
Binary file not shown.

docs/fonts/OpenSans-Light-webfont.eot

-19.1 KB
Binary file not shown.

docs/fonts/OpenSans-Light-webfont.svg

-1,831
This file was deleted.
-21.7 KB
Binary file not shown.
-20.1 KB
Binary file not shown.

docs/fonts/OpenSans-LightItalic-webfont.svg

-1,835
This file was deleted.
-22.9 KB
Binary file not shown.
-19.4 KB
Binary file not shown.

docs/fonts/OpenSans-Regular-webfont.svg

-1,831
This file was deleted.
-22.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)