Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

feat: add gotOptions constructor options #33

Closed

Conversation

buschtoens
Copy link

This allows the user to pass optional options through to the got instance. For instance, users can now connect via proxies.

Here is an example using caw, as further described in sindresorhus/got#435 and originally brought up in sindresorhus/got#79.

import Cloudflare from 'cloudflare':
import caw from 'caw';

const cf = new Cloudflare({
  email: 'you@example.com',
  key: '<your API key here>',
  gotOptions: {
    agent: caw({ protocol: 'https' }) // Cloudflare API is HTTPS only
  }
});

This allows the user to pass optional options through to the `got` instance. For instance, users can now connect via proxies.

Here is an example using [`caw`](https://github.com/kevva/caw), as further described in [sindresorhus/got#435](sindresorhus/got#435 (comment)) and originally brought up in [sindresorhus/got#79](sindresorhus/got#79).

```js
import Cloudflare from 'cloudflare':
import caw from 'caw';

const cf = new Cloudflare({
  email: 'you@example.com',
  key: '<your API key here>',
  gotOptions: {
    agent: caw({ protocol: 'https' }) // Cloudflare API is HTTPS only
  }
});
```
@coveralls
Copy link

coveralls commented Dec 22, 2017

Coverage Status

Coverage decreased (-0.9%) to 85.714% when pulling 061c9a4 on buschtoens:feat-passing-options-to-got into c3e1c83 on cloudflare:master.

@terinjokes
Copy link
Contributor

terinjokes commented Dec 26, 2017

I'm probably going to implement this in a different way, since got is an implementation detail (and worse: likely to be removed). Can you open an issue instead?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants