mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-06-01 17:15:48 +08:00
fix js fetch headers (##589)
This commit is contained in:
20
test/js.js
Normal file
20
test/js.js
Normal file
@@ -0,0 +1,20 @@
|
||||
async function onRequest() {
|
||||
|
||||
|
||||
const fetchResponse = await fetch('https://httpbin.org/anything');
|
||||
console.log(fetchResponse.headers);
|
||||
console.log(await fetchResponse.text());
|
||||
console.log( fetchResponse.body);
|
||||
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
body: fetchResponse.body,
|
||||
headers: fetchResponse.headers
|
||||
};
|
||||
return response;
|
||||
}
|
||||
|
||||
onRequest().then( response => {
|
||||
console.log('Response:', response);
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user