File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
packages/dappmanager/src/modules/https-portal Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ export class HttpsPortalApiClient {
8888 urlJoin ( this . baseUrl , `/?format=json` )
8989 ) ;
9090
91+ if ( ! ajv . validate ( httpsPortalResponseSchema , entries ) ) {
92+ throw Error ( `Invalid response: ${ JSON . stringify ( ajv . errors , null , 2 ) } ` ) ;
93+ }
94+
9195 return entries . map ( entry => ( {
9296 fromSubdomain : entry . from ,
9397 toHost : entry . to
@@ -103,13 +107,7 @@ export class HttpsPortalApiClient {
103107 }
104108
105109 try {
106- const response = JSON . parse ( body ) ;
107-
108- if ( ! ajv . validate ( httpsPortalResponseSchema , response ) ) {
109- throw Error ( `Invalid response: ${ JSON . stringify ( ajv . errors , null , 2 ) } ` ) ;
110- }
111-
112- return response ;
110+ return JSON . parse ( body ) ;
113111 } catch ( e ) {
114112 throw Error ( `Error parsing JSON ${ e . message } \n${ body } ` ) ;
115113 }
You can’t perform that action at this time.
0 commit comments