From 748e08830f151489a8d2cf814c28389be56f2393 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Fri, 7 Jan 2022 11:50:59 +0300 Subject: [PATCH] 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. --- test/smoke_test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/smoke_test.js b/test/smoke_test.js index 3d1e5572991..f5514ef81ae 100644 --- a/test/smoke_test.js +++ b/test/smoke_test.js @@ -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; });