FSN#37150 Als de API2 een 500-error teruggeeft wil ik die wel zien

svn path=/Website/trunk/; revision=30302
This commit is contained in:
Jos Groot Lipman
2016-08-15 14:51:30 +00:00
parent eea453e681
commit e5b322ee5f
3 changed files with 55 additions and 3 deletions

View File

@@ -171,6 +171,43 @@ function zipfile(pathname, filename)
}
xhr.send(null);
// Check for custom 500_error.asp
var xhrb = new XMLHttpRequest();
xhrb.open('GET', 'fac_verify_test.asp?check500b=1');
xhrb.onreadystatechange = function()
{
var txt;
// Ready state 4 means the request is done
if (xhrb.readyState === 4)
{
if (xhrb.status === 500)
{
if (xhrb.responseText == "OK500B")
{
txt = "500_error existingResponse OK";
document.getElementById('result500b').innerHTML = 'Ok';
document.getElementById('result500b').style.color = 'green';
}
else
{
txt = "500_error existingResponse not OK."
+ "<br>In web.config add existingResponse=\"PassThrough\" to &lt;httpErrors&gt; tag";
document.getElementById('result500b').innerHTML = 'Warning';
//document.getElementById('result500b').style.backgroundColor = 'red';
document.getElementById('result500b').style.color = 'yellow';
}
}
else
{
txt = "Strange: could not verify 500_error.asp, status: " + xhrb.status;
}
var div = document.getElementById('check500b');
div.innerHTML = txt;
document.getElementById('check500b').appendChild( div );
}
}
xhrb.send(null);
// Check for PUT for API2
var xhr2 = new XMLHttpRequest();
xhr2.open('PUT', 'fac_verify_test.asp?checkPUT=1');
@@ -627,6 +664,15 @@ checker("500_error.asp",
}
)
checker("500 error for API",
function ()
{
txt = "Checking 500-API handler: <span id='check500b'></span>";
res = resultcodes.unknown;
return { result: res, message: txt, id: "result500b" };
}
)
checker("API2 REST HTTP Verbs",
function ()
{

View File

@@ -16,8 +16,14 @@ Response.Clear();
if (Request.QueryString("check500") == "1")
{
//Response.Status = "500 Internal Server Error"; // gaat niet naar 500_error.asp
eval('FAC_VERIFY_BAD');
eval('FAC_VERIFY_BAD'); // Wordt door ../shared/500_error.asp opgepikt
}
if (Request.QueryString("check500b") == "1")
{
Response.Status = "500 Internal Server Error"; // gaat niet via 500_error.asp
Response.Write("OK500B");
Response.End;
}
if (Request.QueryString("checkPUT") == 1)

View File

@@ -6,7 +6,7 @@
<rules configSource="appl\fac\fac_rewrite.config" />
</rewrite>
-->
<httpErrors>
<httpErrors existingResponse="PassThrough">
<remove statusCode="500" subStatusCode="100" />
<error statusCode="500" subStatusCode="100" path="/appl/shared/500_error.asp" responseMode="ExecuteURL" />
</httpErrors>