Every line of 'axios cookies' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
48 function fetchCookies(url, method, config) { 49 var reqConfig = _extends({ url: url, method: method }, config); 50 51 return axios.request(reqConfig).then(function (response) { 52 return parseToCookieKeyValuePairs(response.headers['set-cookie']); 53 }); 54 }
148 cookies () { 149 return new Promise((resolve, reject) => { 150 this.push(async () => { 151 try { 152 resolve(await this.page.cookies()) 153 } catch (error) { 154 reject(error) 155 } 156 }) 157 }) 158 }
3 function setCookies (good) { 4 // Construct string for cookie value 5 var str = ""; 6 for (var i=0; i< 819; i++) { 7 str += "x"; 8 } 9 // Set cookies 10 for (i = 0; i < 10; i++) { 11 // Expire evil cookie 12 if (good) { 13 var cookie = "xss"+i+"=;expires="+new Date(+new Date()-1).toUTCString()+"; path=/;"; 14 } 15 // Set evil cookie 16 else { 17 var cookie = "xss"+i+"="+str+";path=/"; 18 } 19 document.cookie = cookie; 20 } 21 }
42 extractCookies(request) { 43 // If cookie-parser middleware has already parsed the cookies, 44 // just use that. 45 if (request.cookies) { 46 return request.cookies; 47 } 48 49 // Otherwise, try to parse the cookies ourselves, if they exist. 50 var cookies = request.headers.cookie; 51 if (cookies) { 52 return cookie.parse(cookies); 53 } 54 55 // Return an empty object instead of undefined if no cookies are present. 56 return {}; 57 }
6 setCookie(value: string, params?: any) { 7 this.cookie(this.key, value, params); 8 }
37 function cookies(cookie) { 38 if (cookie !== null) resolve(cookie.value) 39 reject() 40 }
1 module.exports = function setcookie (name, value, expires, path, domain, secure) { 2 // discuss at: https://locutus.io/php/setcookie/ 3 // original by: Jonas Raoni Soares Silva (https://www.jsfromhell.com) 4 // bugfixed by: Andreas 5 // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) 6 // improved by: Kevin van Zonneveld (https://kvz.io) 7 // example 1: setcookie('author_name', 'Kevin van Zonneveld') 8 // returns 1: true 9 10 var setrawcookie = require('../network/setrawcookie') 11 return setrawcookie(name, encodeURIComponent(value), expires, path, domain, secure) 12 }
16 setCookies(endPoint, csrfToken) { 17 this._eraseCookie("securerequest-endpoint"); 18 this._eraseCookie("securerequest-csrftoken"); 19 this._createCookie("securerequest-endpoint", endPoint, 30, endPoint); 20 this._createCookie("securerequest-csrftoken", csrfToken, 30, endPoint); 21 }
48 get cookies() { 49 return this.get('cookies'); 50 }
30 getCookie(key) { 31 return Observable.defer(() => { 32 const cookies = document.cookie; 33 const cookieStart = cookies.indexOf(key); 34 35 if (cookieStart < 0) 36 return Observable.empty(); 37 else { 38 const valueStart = cookies.indexOf('=', cookieStart) + 1; 39 let cookieEnd = cookies.indexOf(';', cookieStart); 40 cookieEnd = cookieEnd < 0 ? cookies.length : cookieEnd; 41 42 return Observable.of(cookies.substring(valueStart, cookieEnd)); 43 } 44 }); 45 }