|
|
@ -92,9 +92,16 @@ namespace Apewer.Web |
|
|
|
url = _context.Provider.GetUrl(); |
|
|
|
if (url == null) return "URL 无效。"; |
|
|
|
|
|
|
|
// Method
|
|
|
|
method = _context.Provider.GetMethod(); |
|
|
|
if (method == HttpMethod.NULL) return "HTTP 方法无效。"; |
|
|
|
if (method == HttpMethod.OPTIONS) return null; |
|
|
|
switch (method) |
|
|
|
{ |
|
|
|
case HttpMethod.NULL: |
|
|
|
return "HTTP 方法无效。"; |
|
|
|
case HttpMethod.OPTIONS: |
|
|
|
if (!_context.Options.AllowOptions) return null; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
// favicon.ico
|
|
|
|
var lowerPath = TextUtility.AssureStarts(TextUtility.Lower(url.AbsolutePath), "/"); |
|
|
@ -127,8 +134,11 @@ namespace Apewer.Web |
|
|
|
// OPTIONS
|
|
|
|
if (_context.Request.Method == HttpMethod.OPTIONS) |
|
|
|
{ |
|
|
|
_context.Response.Model = new ApiTextModel(""); |
|
|
|
return; |
|
|
|
if (!_context.Options.AllowOptions) |
|
|
|
{ |
|
|
|
_context.Response.Model = new ApiTextModel(""); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 路由
|
|
|
|