Refactor handling of environment variables (#2303)

* Refactor environment variables

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-09-16 11:03:29 +02:00 committed by GitHub
parent e412115a78
commit 39a4125cb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 624 additions and 461 deletions

View file

@ -5,6 +5,7 @@
*/
import type { NextApiRequest, NextApiResponse } from 'next'
import { isMockMode } from '../utils/test-modes'
export enum HttpMethod {
GET = 'GET',
@ -31,6 +32,10 @@ export const respondToMatchingRequest = <T>(
response: T,
statusCode = 200
): boolean => {
if (!isMockMode) {
res.status(404).send('Mock API is disabled')
return false
}
if (method !== req.method) {
res.status(405).send('Method not allowed')
return false