Add check to validiate if the request is valid
This commit is contained in:
parent
c4ae5d4cf3
commit
e7706effdb
@ -15,6 +15,12 @@ const KEY = "BL_MAP_STAR_";
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
if (!req.query.hash || !req.query.difficulty || !req.query.characteristic) {
|
||||||
|
return res.status(404).json({
|
||||||
|
status: 404,
|
||||||
|
message: "Invalid request",
|
||||||
|
});
|
||||||
|
}
|
||||||
const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase();
|
const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase();
|
||||||
const difficulty = req.query.difficulty.replace(" ", "");
|
const difficulty = req.query.difficulty.replace(" ", "");
|
||||||
const characteristic = req.query.characteristic;
|
const characteristic = req.query.characteristic;
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import { getMapData } from "../../../../src/helpers/beatSaverHelpers";
|
import { getMapData } from "../../../../src/helpers/beatSaverHelpers";
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
if (!req.query.hash) {
|
||||||
|
return res.status(404).json({
|
||||||
|
status: 404,
|
||||||
|
message: "Invalid request",
|
||||||
|
});
|
||||||
|
}
|
||||||
const mapHash = req.query.hash;
|
const mapHash = req.query.hash;
|
||||||
|
|
||||||
const mapData = await getMapData(mapHash);
|
const mapData = await getMapData(mapHash);
|
||||||
|
@ -16,6 +16,12 @@ const KEY = "SS_MAP_STAR_";
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
|
if (!req.query.hash) {
|
||||||
|
return res.status(404).json({
|
||||||
|
status: 404,
|
||||||
|
message: "Invalid request",
|
||||||
|
});
|
||||||
|
}
|
||||||
const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase();
|
const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase();
|
||||||
const difficulty = req.query.difficulty.replace(" ", "");
|
const difficulty = req.query.difficulty.replace(" ", "");
|
||||||
const characteristic = req.query.characteristic;
|
const characteristic = req.query.characteristic;
|
||||||
|
Reference in New Issue
Block a user