mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-29 19:03:42 +00:00
clean up the code
clean up the code
This commit is contained in:
parent
33d8fadc8f
commit
b32801c1c9
|
|
@ -529,11 +529,6 @@ namespace WelsonJS.Launcher
|
||||||
respHeaders["Access-Control-Allow-Credentials"] = "true";
|
respHeaders["Access-Control-Allow-Credentials"] = "true";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
respHeaders["Access-Control-Allow-Origin"] = origin;
|
|
||||||
respHeaders["Access-Control-Allow-Credentials"] = "true";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -549,17 +544,15 @@ namespace WelsonJS.Launcher
|
||||||
// Apply CORS headers once here
|
// Apply CORS headers once here
|
||||||
TryApplyCors(context);
|
TryApplyCors(context);
|
||||||
|
|
||||||
var requestHeaders = context.Request.Headers["Access-Control-Request-Headers"];
|
var respHeaders = context.Response.Headers;
|
||||||
var requestMethod = context.Request.Headers["Access-Control-Request-Method"];
|
respHeaders["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS";
|
||||||
|
respHeaders["Access-Control-Allow-Headers"] = "Content-Type, Authorization, X-Requested-With";
|
||||||
var h = context.Response.Headers;
|
respHeaders["Access-Control-Max-Age"] = "600";
|
||||||
h["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS";
|
|
||||||
h["Access-Control-Allow-Headers"] = "Content-Type, Authorization, X-Requested-With";
|
|
||||||
h["Access-Control-Max-Age"] = "600";
|
|
||||||
|
|
||||||
context.Response.StatusCode = 204;
|
context.Response.StatusCode = 204;
|
||||||
context.Response.ContentLength64 = 0;
|
context.Response.ContentLength64 = 0;
|
||||||
context.Response.OutputStream.Close();
|
context.Response.OutputStream.Close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user