支持flutter调用
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
abstract class WebServer {
|
||||
static late WebServer _webServer;
|
||||
|
||||
@@ -24,9 +26,26 @@ enum HttpMethod {
|
||||
;
|
||||
}
|
||||
|
||||
enum HttpResponseType {
|
||||
HTML("text/html; charset=utf-8"),
|
||||
TEXT("text/plain; charset=utf-8"),
|
||||
XML("text/xml; charset=utf-8"),
|
||||
JSON("application/json; charset=utf-8"),
|
||||
BINARY("application/octet-stream"),
|
||||
;
|
||||
|
||||
final String type;
|
||||
|
||||
const HttpResponseType(this.type);
|
||||
}
|
||||
|
||||
class RequestMapping {
|
||||
final HttpMethod method;
|
||||
final String path;
|
||||
final HttpResponseType responseType;
|
||||
|
||||
const RequestMapping({this.method = HttpMethod.ALL, required this.path});
|
||||
const RequestMapping(
|
||||
{this.method = HttpMethod.ALL,
|
||||
required this.path,
|
||||
this.responseType = HttpResponseType.JSON});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user