Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request is deprecated #10

Open
KenEucker opened this issue Feb 17, 2021 · 6 comments
Open

request is deprecated #10

KenEucker opened this issue Feb 17, 2021 · 6 comments

Comments

@KenEucker
Copy link

request/request#3142

Request has been deprecated. Can we get an update to replace this dependency?

@abernier
Copy link
Owner

I guess I should switch to another request library, one that supports cookies jar.

I have currently no time for a such re-write, but pull-request are really welcome :)

Since tests are already here, it should be easier not to break anything hopefully.

@KenEucker
Copy link
Author

@abernier is there anything else besides supporting cookies jar that you can point out needs to be supported?

If I get the opportunity to translate my own experiences with got to this package I will look into running the tests and providing a PR.

@abernier
Copy link
Owner

abernier commented Feb 17, 2021

@abernier is there anything else besides supporting cookies jar that you can point out needs to be supported?

  1. src/index.js

    Currently uest function is calling request with this signature:

    request(options, callback)

    as in:

    request(options, function (er, resp, data) {

    , defaulting options with some default values (baseUrl, jar, json):

    uest/src/index.js

    Lines 33 to 38 in 8fb4a17

    defaults(options, {
    baseUrl,
    json: true,
    jar: jar,
    headers: {"X-Requested-With": "req.uest"}
    })

    =>

    implementing got in an adapter request function may be easier:

    function request(options, callback) {
      // ... use `got` inside
    }
  2. test/index.js

    I also rely on request to make HTTP requests to the express server in the tests.

    • I wouldn't touch to this file until 1. is complete and passes all the tests.
    • then, you could replace request with got into test/index.js also (but it is fine if we leave a devDependency to request for now :))

If I get the opportunity to translate my own experiences with got to this package I will look into running the tests and providing a PR.

This would be awesome !! 🙏 I would review it for sure and help!

@abernier
Copy link
Owner

abernier commented Feb 18, 2021

Also, from this issue, it seems quite easy to add support for cookies jar to got with the same library tough-cookie request is using :

const got = require("got")
const { CookieJar } = require("tough-cookie")

cookieJar = new CookieJar()
client = got.extend({ cookieJar })

However, this issue is about a problem with tough-cookie@2.5 which is the version request is still using... Hopefully, if no breaking changes in tough-cookie@latest's API since, it shouldn't be harder than that.

🍪

@abernier
Copy link
Owner

abernier commented Mar 2, 2021

Hi @KenEucker, do you need any help ?

@KenEucker
Copy link
Author

@abernier I would collaborate, for sure. I was able to use got as a replacement in another package but my attempts to work the cookiejar into this package were not successful.

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

No branches or pull requests

2 participants