💾 Archived View for iich.space › src › middleware › withQuery.ts captured on 2022-03-01 at 16:00:05.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

import { Status } from '@/gemini';
import { Handler } from '@/mission-control';

const withQuery =
  (meta: string, secure = false): Handler =>
  (req, res) => {
    if (req.query === null || req.query.trim() === '') {
      res.sendStatus(secure ? Status.SENSITIVE_INPUT : Status.INPUT, meta);
      res.end();
    }
  };

export default withQuery;