DEV: Log response headers when getting rate limit errors during smoke tests (#15487)

We've recently added diagnostic headers that Discourse includes in the response when it rate limits a request. This PR makes our smoke tests runner log the response headers it encounters a rate limit error so we can get a better visibility into what caused the rate limit.
This commit is contained in:
Osama Sayegh 2022-01-07 11:50:59 +03:00 committed by GitHub
parent 6b6c0fef4c
commit 748e08830f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -76,6 +76,13 @@ const path = require("path");
console.log(
"FAILED HTTP REQUEST TO " + resp.url() + " Status is: " + resp.status()
);
if (resp.status() === 429) {
const headers = resp.headers();
console.log("Response headers:");
Object.keys(headers).forEach((key) => {
console.log(`${key}: ${headers[key]}`);
});
}
}
return resp;
});