diff --git a/packages/td-tools/src/thing-model-helpers.ts b/packages/td-tools/src/thing-model-helpers.ts index 074b8944e..ecb434f2d 100644 --- a/packages/td-tools/src/thing-model-helpers.ts +++ b/packages/td-tools/src/thing-model-helpers.ts @@ -241,7 +241,7 @@ export class ThingModelHelpers { case "http": { return new Promise((resolve, reject) => { http.get(uri, (res) => { - if (res.statusCode === undefined || res.statusCode !== 200) { + if (res?.statusCode !== 200) { reject(new Error(`http status code not 200 but ${res.statusCode} for ${uri}`)); }