Skip to content

Commit

Permalink
4.0.0: add compatibility for axios
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanent committed Mar 25, 2024
1 parent 5cb6d74 commit 91f34c9
Show file tree
Hide file tree
Showing 38 changed files with 184 additions and 26,443 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [20.x, 21.x]

steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

> The lightweight Node.js HTTP client
[Full documentation](https://ethanent.github.io/phin/global.html) | [GitHub](https://github.com/ethanent/phin) | [NPM](https://www.npmjs.com/package/phin)

## Deprecated

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

const res = await p('https://ethanent.me')
const res = await p('https://example.com')

console.log(res.body)
```
Expand All @@ -42,7 +40,7 @@ Simple POST:

```js
await p({
url: 'https://ethanent.me',
url: 'https://example.com',
method: 'POST',
data: {
hey: 'hi'
Expand All @@ -55,7 +53,7 @@ await p({
```js
const p = require('phin').unpromisified

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

const res = await p({
'url': 'https://ethanent.me/name',
'url': 'https://example.com/',
'parse': 'json'
})

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

// In async function...

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

// Do things with res.body?
```

### Custom Core HTTP Options
### Custom Axios HTTP Options

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

```js
await p({
'url': 'https://ethanent.me/name',
'core': {
'agent': myAgent // Assuming you'd already created myAgent earlier.
'url': 'https://example.com/name',
'axiosOpts': {
httpAgent: myAgent // Assuming you'd already created myAgent earlier.
}
})
```


## Full Documentation

There's a lot more which can be done with the Phin library.

See [the Phin documentation](https://ethanent.github.io/phin/global.html).


## Phin vs. the Competition

Phin is a very lightweight library, yet it contains all of the common HTTP client features included in competing libraries!
Expand Down
5 changes: 0 additions & 5 deletions SECURITY.md

This file was deleted.

Binary file removed docs/fonts/OpenSans-Bold-webfont.eot
Binary file not shown.
1,830 changes: 0 additions & 1,830 deletions docs/fonts/OpenSans-Bold-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-Bold-webfont.woff
Binary file not shown.
Binary file removed docs/fonts/OpenSans-BoldItalic-webfont.eot
Binary file not shown.
1,830 changes: 0 additions & 1,830 deletions docs/fonts/OpenSans-BoldItalic-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-BoldItalic-webfont.woff
Binary file not shown.
Binary file removed docs/fonts/OpenSans-Italic-webfont.eot
Binary file not shown.
1,830 changes: 0 additions & 1,830 deletions docs/fonts/OpenSans-Italic-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-Italic-webfont.woff
Binary file not shown.
Binary file removed docs/fonts/OpenSans-Light-webfont.eot
Binary file not shown.
1,831 changes: 0 additions & 1,831 deletions docs/fonts/OpenSans-Light-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-Light-webfont.woff
Binary file not shown.
Binary file removed docs/fonts/OpenSans-LightItalic-webfont.eot
Binary file not shown.
1,835 changes: 0 additions & 1,835 deletions docs/fonts/OpenSans-LightItalic-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-LightItalic-webfont.woff
Binary file not shown.
Binary file removed docs/fonts/OpenSans-Regular-webfont.eot
Binary file not shown.
1,831 changes: 0 additions & 1,831 deletions docs/fonts/OpenSans-Regular-webfont.svg

This file was deleted.

Binary file removed docs/fonts/OpenSans-Regular-webfont.woff
Binary file not shown.

0 comments on commit 91f34c9

Please sign in to comment.