-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
207 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
const https = require('node:https'); | ||
export async function HttpGetWithCookies(url: string): Promise<Map<string, string>> { | ||
return new Promise((resolve, reject) => { | ||
let result: Map<string, string> = new Map<string, string>(); | ||
const req = https.get(url, (res: any) => { | ||
res.on('data', (data: any) => { | ||
}); | ||
res.on('end', () => { | ||
try { | ||
const responseCookies = res.headers['set-cookie']; | ||
for (const line of responseCookies) { | ||
const parts = line.split(';'); | ||
const [key, value] = parts[0].split('='); | ||
result.set(key, value); | ||
} | ||
} catch (e) { | ||
} | ||
resolve(result); | ||
return new Promise((resolve, reject) => { | ||
const result: Map<string, string> = new Map<string, string>(); | ||
const req = https.get(url, (res: any) => { | ||
res.on('data', (data: any) => { | ||
}); | ||
res.on('end', () => { | ||
try { | ||
const responseCookies = res.headers['set-cookie']; | ||
for (const line of responseCookies) { | ||
const parts = line.split(';'); | ||
const [key, value] = parts[0].split('='); | ||
result.set(key, value); | ||
} | ||
} catch (e) { | ||
} | ||
resolve(result); | ||
|
||
}); | ||
}); | ||
req.on('error', (error: any) => { | ||
resolve(result); | ||
// console.log(error) | ||
}) | ||
req.end() | ||
}) | ||
}); | ||
}); | ||
req.on('error', (error: any) => { | ||
resolve(result); | ||
// console.log(error) | ||
}); | ||
req.end(); | ||
}); | ||
|
||
} | ||
export async function HttpPostCookies(url: string): Promise<Map<string, string>> { | ||
return new Promise((resolve, reject) => { | ||
let result: Map<string, string> = new Map<string, string>(); | ||
const req = https.get(url, (res: any) => { | ||
res.on('data', (data: any) => { | ||
}); | ||
res.on('end', () => { | ||
try { | ||
const responseCookies = res.headers['set-cookie']; | ||
for (const line of responseCookies) { | ||
const parts = line.split(';'); | ||
const [key, value] = parts[0].split('='); | ||
result.set(key, value); | ||
} | ||
} catch (e) { | ||
} | ||
resolve(result); | ||
return new Promise((resolve, reject) => { | ||
const result: Map<string, string> = new Map<string, string>(); | ||
const req = https.get(url, (res: any) => { | ||
res.on('data', (data: any) => { | ||
}); | ||
res.on('end', () => { | ||
try { | ||
const responseCookies = res.headers['set-cookie']; | ||
for (const line of responseCookies) { | ||
const parts = line.split(';'); | ||
const [key, value] = parts[0].split('='); | ||
result.set(key, value); | ||
} | ||
} catch (e) { | ||
} | ||
resolve(result); | ||
|
||
}); | ||
}); | ||
req.on('error', (error: any) => { | ||
resolve(result); | ||
// console.log(error) | ||
}) | ||
req.end() | ||
}) | ||
}); | ||
}); | ||
req.on('error', (error: any) => { | ||
resolve(result); | ||
// console.log(error) | ||
}); | ||
req.end(); | ||
}); | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.