Code Monkey home page Code Monkey logo

Comments (8)

floatdrop avatar floatdrop commented on April 28, 2024

@sbrl got does not have cookie support out-of-the-box, but it can be easly achieved with cookie module:

let got = require('got');
let cookie = require('cookie');

got('google.com', {
    headers: {
        cookie: cookie.serialize('foo', 'bar')
    }
});

See also:

from got.

sbrl avatar sbrl commented on April 28, 2024

Ok, Thanks! I was hoping that there would be built in support. I'll see what I can do. The problem is that I need to make multiple different requests and save the cookie state after each one in order to login to a particular online service :/

from got.

floatdrop avatar floatdrop commented on April 28, 2024

@sbrl I'd recommend make all requests to this service through new module (like gh-got or vk-got) and add default jar storage into it.

from got.

sbrl avatar sbrl commented on April 28, 2024

Default jar storage? What's that?

from got.

floatdrop avatar floatdrop commented on April 28, 2024

@sbrl shared instance of tough-cookie for example.

from got.

sbrl avatar sbrl commented on April 28, 2024

@floatdrop Right. I don't understand how I can pass a default jar into a gh-got or vk-got instance without doing it manually - in which case I should use vanilla got instead. Sorry for all the questions :(

from got.

FranklinYu avatar FranklinYu commented on April 28, 2024

Bloated request has built-in cookie jar support.

from got.

gajus avatar gajus commented on April 28, 2024

This thread doesn't answer the question how to use tough-cookie with got, e.g. How will the redirects be handled?

from got.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.