improve cookie handling by ensuring cookies are properly typed and refactor data event listener for consistency
This commit is contained in:
parent
edd50ef9b1
commit
dc8c150ce8
@ -112,11 +112,12 @@ export default class Flummpress {
|
||||
searchParams: url.searchParams,
|
||||
qs: Object.fromEntries(url.searchParams.entries()),
|
||||
};
|
||||
|
||||
req.cookies = {};
|
||||
if(req.headers.cookie) {
|
||||
req.headers.cookie.split("; ").forEach(cookie => {
|
||||
const [key, value] = cookie.split("=");
|
||||
req.cookies[key] = decodeURIComponent(value);
|
||||
req.cookies![key] = decodeURIComponent(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -130,7 +131,7 @@ export default class Flummpress {
|
||||
return new Promise((resolve, reject) => {
|
||||
let body = "";
|
||||
|
||||
req.on("data", (chunk) => {
|
||||
req.on("data", chunk => {
|
||||
body += chunk;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user