Update API endpoints to read URL params from either option

This commit is contained in:
Alicia Sykes
2023-07-28 21:46:20 +01:00
parent e2e16c9439
commit d03acb8a3c
22 changed files with 33 additions and 23 deletions

View File

@ -2,8 +2,9 @@ const axios = require('axios');
const xml2js = require('xml2js');
exports.handler = async (event) => {
const baseUrl = event.queryStringParameters.url.replace(/^(?:https?:\/\/)?/i, "");
const url = baseUrl.startsWith('http') ? baseUrl : `http://${baseUrl}`;
const url = (event.queryStringParameters || event.query).url;
// const baseUrl = event.queryStringParameters.url.replace(/^(?:https?:\/\/)?/i, "");
// const url = baseUrl.startsWith('http') ? baseUrl : `http://${baseUrl}`;
let sitemapUrl;
try {