2023-07-22 16:18:28 +02:00
|
|
|
const axios = require('axios');
|
2023-06-21 15:28:42 +02:00
|
|
|
|
|
|
|
exports.handler = async function(event, context) {
|
|
|
|
const { url } = event.queryStringParameters;
|
|
|
|
|
|
|
|
if (!url) {
|
|
|
|
return {
|
|
|
|
statusCode: 400,
|
|
|
|
body: JSON.stringify({ message: 'url query string parameter is required' }),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2023-07-22 16:18:28 +02:00
|
|
|
const response = await axios.get(url, {withCredentials: true});
|
|
|
|
const cookies = response.headers['set-cookie'];
|
2023-06-21 15:28:42 +02:00
|
|
|
return {
|
|
|
|
statusCode: 200,
|
|
|
|
body: JSON.stringify({ cookies }),
|
|
|
|
};
|
|
|
|
} catch (error) {
|
|
|
|
return {
|
|
|
|
statusCode: 500,
|
2023-07-10 00:23:50 +02:00
|
|
|
body: JSON.stringify({ error: error.message }),
|
2023-06-21 15:28:42 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|