nv-cookie-parse-set-cookie
v1.0.6
Published
nv-cookie-parse-set-cookie ======================= - a loose set-cookie parse for error recover
Downloads
3
Readme
nv-cookie-parse-set-cookie
- a loose set-cookie parse for error recover
install
- npm install nv-cookie-parse-set-cookie
splitted
usage
const x = require("nv-cookie-parse-set-cookie");
example
> r=x.parse_from_str("myCookie=123;domain=www.baidu.com;path=/one/;expires=Mon,22-Jan-07 07:10:24 GMT;Secure;HttpOnly")
Simple(11) [
'myCookie', '123',
'www.baidu.com', '/one/',
undefined, 1169449824000,
true, false,
false, true,
undefined
]
r.to_set_cookie_str((r)=>r)
'Set-Cookie: myCookie=123; domain=www.baidu.com; path=/one/; expires=Mon, 22 Jan 2007 07:10:24 GMT; httpOnly; secure'
>
r=x.parse_from_str("domain=www.baidu.com;path=/one/;expires=Mon,22-Jan-07 07:10:24 GMT;Secure;myCookie=123;HttpOnly")
> r.to_set_cookie_str((r)=>r)
'Set-Cookie: myCookie=123; domain=www.baidu.com; path=/one/; expires=Mon, 22 Jan 2007 07:10:24 GMT; httpOnly; secure'
>
>
r=x.parse_from_str("HttpOnly; domain=www.baidu.com;path=/one/;myCookie=123;expires=Mon,22-Jan-07 07:10:24 GMT;Secure;")
> r.to_set_cookie_str((r)=>r)
'Set-Cookie: myCookie=123; path=/one/; expires=Mon, 22 Jan 2007 07:10:24 GMT; httpOnly; secure'
>
>
r=x.parse_from_str("HttpOnly,domain=www.baidu.com,path=/one/,myCookie=123,expires=Mon,22-Jan-07 07:10:24 GMT;Secure;")
> r.to_set_cookie_str()
'Set-Cookie: myCookie=123; domain=www.baidu.com; path=%2Fone%2F; expires=Mon, 22 Jan 2007 07:10:24 GMT; httpOnly; secure'
>
x=require("./index")
r=x.parse_from_str("HttpOnly domain=www.baidu.com path=/one/ myCookie=123 expires=Mon,22-Jan-07 07:10:24 GMT; Secure;")
r.to_set_cookie_str((r)=>r)
x=require("./index")
r=x.parse_from_str("HttpOnly domain=www.baidu.com path=/one/ myCookie=123 expires=Mon,22-Jan-07 07:10:24 GMT; Secure;")
r.to_set_cookie_str((r)=>r)
x=require("./index")
r=x.parse_from_str("HttpOnly,domain=www.baidu.com ;path=/one/ myCookie=123; expires=Mon,22-Jan-07 07:10:24 GMT; Secure;")
r.to_set_cookie_str((r)=>r)
METHODS
APIS
LICENSE
- ISC