2023-07-22 16:18:28 +02:00
|
|
|
const axios = require('axios');
|
2023-08-09 23:33:36 +02:00
|
|
|
const middleware = require('./_common/middleware');
|
2023-06-21 15:28:42 +02:00
|
|
|
|
2023-08-09 23:33:36 +02:00
|
|
|
const handler = async (url, event, context) => {
|
2023-06-21 15:28:42 +02:00
|
|
|
try {
|
2023-07-22 16:18:28 +02:00
|
|
|
const response = await axios.get(url, {withCredentials: true});
|
|
|
|
const cookies = response.headers['set-cookie'];
|
2023-08-09 23:33:36 +02:00
|
|
|
return { cookies };
|
2023-06-21 15:28:42 +02:00
|
|
|
} catch (error) {
|
2023-08-09 23:33:36 +02:00
|
|
|
throw new Error(error.message);
|
2023-06-21 15:28:42 +02:00
|
|
|
}
|
|
|
|
};
|
2023-08-09 23:33:36 +02:00
|
|
|
|
|
|
|
exports.handler = middleware(handler);
|