Skip to content

Commit

Permalink
[fix] apiのエラー文を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
imaimai17468 committed Aug 25, 2023
1 parent 382088f commit e8b7f00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions view/src/pages/api/parkings/[parkingName].ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { method } = req
const { parkingName } = req.query
if (typeof parkingName !== 'string') throw new Error('parkingName is not string')
if (!isParkingName(parkingName)) throw new Error('parkingName is not valid')
if (!isParkingName(parkingName)) throw new Error('parkingName is not found')

switch (method) {
case 'GET': {
Expand All @@ -19,7 +19,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
break
}
default:
res.setHeader('Allow', ['GET', 'PUT'])
res.setHeader('Allow', ['GET'])
if (method) res.status(405).end(`Method ${method} Not Allowed`)
else res.status(405).end(`Method Not Allowed`)
}
Expand Down

0 comments on commit e8b7f00

Please sign in to comment.