支持flutter调用

This commit is contained in:
2025-01-15 09:55:42 +08:00
parent 234d8ea7ca
commit 0fee2d7f69
7 changed files with 88 additions and 17 deletions

View File

@@ -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});
}