Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ wiki({
}).search('Winterfell');
```

## Usage with Proxy
You can use proxy with `https-proxy-agent`
```js
const HttpsProxyAgent = require('https-proxy-agent')

wiki({agent: new HttpsProxyAgent('http://address:port')})
.page('Batman')
.then(page => page.info('alterEgo'))
.then(console.log) // Bruce Wayne

```

## Chain data requests together for more efficient applications

Query a specific page:
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function api(apiOptions, params = {}) {
{ 'User-Agent': 'WikiJS Bot v1.0' },
apiOptions.headers
);
return fetch(url, Object.assign({ headers }, fetchOptions))
return fetch(url, Object.assign({ headers }, fetchOptions, {agent: apiOptions.agent}))
.then(res => {
if (res.ok) {
return res.json();
Expand Down