Skip to content
This repository was archived by the owner on Jun 30, 2020. It is now read-only.
This repository was archived by the owner on Jun 30, 2020. It is now read-only.

Expose it as got decorator #66

@Kikobeats

Description

@Kikobeats

Hello,

Do you think could be possible to expose a more affordable interface in order to make it easy to accommodate any project using got?

This is the thing I have on mind:

const got = require('@ctrl/cloudflare')(require('got')

Internally it can do the thing suggested on the readme:

const decorator = got = async (...opts) => {
  let res

  try {
    res = await got(...opts);
  } catch (error) {
    res = await catchCloudflare(error, ...opts);
  }

  if (res) return res
  throw error
}

In fact, that could be a good moment to create cookieJar is it isn't been passed as a parameter.

Feeling something like this could reduce the friction of adopting the library a lot. Thoughts? 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions