fix(document from url): now listens to fix reaction to bad responses

This commit is contained in:
Philipp Kunz 2021-11-25 23:43:10 +01:00
parent d540431158
commit cf7709576a

View File

@ -123,7 +123,12 @@ export class Smartswagger {
headers: {
'accept-encoding': 'application/json',
},
}).catch(err => {
console.log(err);
});
if (!documentResponse || documentResponse.status > 299) {
return;
}
const documentString = await documentResponse.text();
const apiDoc: IExtendedApiDoc = JSON.parse(documentString);
console.log(`document successfully fetched!`);