Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pages/api/getContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ export default async function handler(
res: NextApiResponse,
) {
if (req.method !== 'GET') {
res.status(405)
res.setHeader('Allow', ['GET'])
return res.status(405).json({ error: 'Method Not Allowed' })
}

const addr = req.query?.address as string
const ethscan_resp = await etherscanGetSource(addr)
const data = await ethscan_resp.json()
res.status(200).json(data)
return res.status(200).json(data)
}
11 changes: 6 additions & 5 deletions pages/api/getDynamicDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
if (req.method === 'POST') {
const { body } = req
res.status(200).json({ mdx: await serialize(body.content) })
} else {
res.status(405)
if (req.method !== 'POST') {
res.setHeader('Allow', ['POST'])
return res.status(405).json({ error: 'Method Not Allowed' })
}

const { body } = req
return res.status(200).json({ mdx: await serialize(body.content) })
}