Skip to content

Commit

Permalink
QNAP widget make sure re-auth status = 200
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed May 19, 2023
1 parent d402be2 commit a9d3873
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/widgets/qnap/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ async function apiCall(widget, endpoint, service) {
key = await login(widget, service);
apiUrl = new URL(formatApiCall(`${endpoint}&sid=${key}`, widget));
[status, contentType, data, responseHeaders] = await httpProxy(apiUrl);

if (status !== 200) {
logger.error("Error getting data from QNAP: %s status %d. Data: %s", apiUrl, status, data);
return { status, contentType, data: null, responseHeaders };
}

dataDecoded = JSON.parse(xml2json(data.toString(), { compact: true }).toString());
}

Expand Down

0 comments on commit a9d3873

Please sign in to comment.