We are modifying code that displays in response to a Server sending either a 401 or a 403 error.
export const handleStatusCodeMessage = (errorStatusCode, verbiageConfig, errorStatusMessage) => {
let {errorType, errorMessage} = '';
switch (errorStatusCode) {
case '401':
if (isMember()) {
errorType = GENERAL_ERROR.ERROR_TYPE;
errorMessage = GENERAL_ERROR.ERROR_MESSAGE + getVerbiageTrailMessage(verbiageConfig);
} else {
errorType = UNAUTHORIZED.ERROR_TYPE;
errorMessage = UNAUTHORIZED.ERROR_MESSAGE;
}
break;
case '403':
if (isMember()) {
errorType = GENERAL_ERROR.ERROR_TYPE;
errorMessage = GENERAL_ERROR.ERROR_MESSAGE + getVerbiageTrailMessage(verbiageConfig);
} else {
errorType = UNAUTHORIZED.ERROR_TYPE;
errorMessage = UNAUTHORIZED.ERROR_MESSAGE;
}
break;
case 'etc': // other cases
}
return {errorType, errorMessage};
};
These are different cases, and part of the acceptance criteria for our banking industry is that we show screenshots of the page in the browser before and after the code changes, so that management can easily tell what the impact was.
How do I catch the return stream in Chrome, modify the server response on my local machine, and return a 401 or a 403 to my browser so we can get screenshots of it in the browser?
We have to check both: 401 and 403.
The closest similar question I was able to find was here:
How to generate sample 401, 403 http responses?
But the answer there was just a link, and the link is no longer valid. :(