Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

579
Views
La configuración de cookies a través de solicitudes de NPM no funciona
// Require the request const request = require('request'); let api_url = 'https://some-api-that-requires-cookies.com' // Setup the cookie jar to carry cookies const cookieJar = request.jar(); let cookie = request.cookie('data=3'); cookieJar.setCookie(cookie); // Add your cookie to the jar (URL is parsed into cookie parts) // Send your request and include the cookie jar request({url: api_url, jar: cookieJar}, (error, response, body)=>{ // do things console.log(response.headers['set-cookie']) } );

Producción:

 [ 'sess_id=D8w23-9%!3832ed; Path=/CookieExample; Secure; HttpOnly' ]

mi cookie de datos = 3 no se muestra, y mi respuesta sigue siendo acceso denegado (la respuesta JSON si la cookie de datos = 3 no existe) ¿Mi cookie no se está registrando? ¿O el registro de la consola se está ejecutando antes de agregar la cookie? cualquier idea es útil

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La request está completamente obsoleta, use axios por ejemplo.

Todas las sintaxis están completamente documentadas en la biblioteca oficial de npm.

después:

 const axios = require('axios') axios.get(URL, { withCredentials: true, // to able getting cookies from the server back headers: { // put cookies in here Cookie: "cookie1=value; cookie2=value; cookie3=value;" } }).then(res =>{ // res.data is your data back })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!