File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ import { NowRequest, NowResponse } from '@vercel/node'
22import { getScreenshot } from './_lib/chromium' ;
33
44module . exports = async ( req : NowRequest , res : NowResponse ) => {
5+ if ( ! req . query . url ) return res . json ( {
6+ "success" : false ,
7+ "error" : "No url query specified!" ,
8+ "usage" : "https://screenshot.totallyusefulapi.ml/api?url=https://totallyusefulapi.ml&width=930&height=625"
9+ } ) ;
510 try {
611 const file = await getScreenshot ( req . query . url , req . query . width , req . query . height ) ;
712 res . setHeader ( 'Content-Type' , `image/png` ) ;
@@ -11,8 +16,8 @@ module.exports = async (req: NowRequest, res: NowResponse) => {
1116 res . setHeader ( 'Content-Type' , 'application/json' ) ;
1217 res . json ( {
1318 "success" : false ,
14- "error" : "No url query" ,
15- "usage" : "https://screenshot.totallyusefulapi.ml/api?url=https://totallyusefulapi.ml&width=1920 &height=180 "
19+ "error" : "Invalid url query! " ,
20+ "usage" : "https://screenshot.totallyusefulapi.ml/api?url=https://totallyusefulapi.ml&width=930 &height=625 "
1621 } ) ;
1722 }
1823}
You can’t perform that action at this time.
0 commit comments