Skip to content

Commit 387795c

Browse files
committedFeb 23, 2021
fix: crash on options method
1 parent 1dbd119 commit 387795c

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
lines changed
 

‎.DS_Store

6 KB
Binary file not shown.

‎example/.DS_Store

6 KB
Binary file not shown.

‎example/lib/.DS_Store

6 KB
Binary file not shown.

‎lib/src/core/src/server_main.dart

+27-25
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,33 @@ class GetServer with NodeMode {
133133
if (route != null) {
134134
route.handle(req);
135135
} else {
136-
if (_public != null) {
137-
_virtualDirectory ??= VirtualDirectory(
138-
_public.folder,
139-
// pathPrefix: public.path,
140-
)
141-
..allowDirectoryListing = _public.allowDirectoryListing
142-
..jailRoot = _public.jailRoot
143-
..followLinks = _public.followLinks
144-
..errorPageHandler = (callback) {
145-
_onNotFound(
146-
callback,
147-
onNotFound,
148-
);
149-
}
150-
..directoryHandler = (dir, req) {
151-
var indexUri = Uri.file(dir.path).resolve('index.html');
152-
_virtualDirectory.serveFile(File(indexUri.toFilePath()), req);
153-
};
154-
155-
_virtualDirectory.serveRequest(req);
156-
} else {
157-
_onNotFound(
158-
req,
159-
onNotFound,
160-
);
136+
if (req.method.toLowerCase() != 'options') {
137+
if (_public != null) {
138+
_virtualDirectory ??= VirtualDirectory(
139+
_public.folder,
140+
// pathPrefix: public.path,
141+
)
142+
..allowDirectoryListing = _public.allowDirectoryListing
143+
..jailRoot = _public.jailRoot
144+
..followLinks = _public.followLinks
145+
..errorPageHandler = (callback) {
146+
_onNotFound(
147+
callback,
148+
onNotFound,
149+
);
150+
}
151+
..directoryHandler = (dir, req) {
152+
var indexUri = Uri.file(dir.path).resolve('index.html');
153+
_virtualDirectory.serveFile(File(indexUri.toFilePath()), req);
154+
};
155+
156+
_virtualDirectory.serveRequest(req);
157+
} else {
158+
_onNotFound(
159+
req,
160+
onNotFound,
161+
);
162+
}
161163
}
162164
}
163165
},

‎lib/src/infrastructure/get_instance/lifecycle.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ mixin GetLifeCycle {
4343
/// It uses an internal "callable" type, to avoid any @overrides in subclases.
4444
/// This method should be internal and is required to define the
4545
/// lifetime cycle of the subclass.
46-
@internal
46+
// @internal
4747
void onStart() {
4848
if (_initialized) return;
4949
onInit();
@@ -57,7 +57,7 @@ mixin GetLifeCycle {
5757
bool get isClosed => _isClosed;
5858

5959
// Internal callback that starts the cycle of this controller.
60-
@internal
60+
// @internal
6161
void onDelete() {
6262
if (_isClosed) return;
6363
_isClosed = true;

‎pubspec.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ packages:
1414
name: charcode
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.1.3"
17+
version: "1.2.0"
1818
collection:
1919
dependency: transitive
2020
description:
2121
name: collection
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.14.13"
24+
version: "1.15.0"
2525
convert:
2626
dependency: transitive
2727
description:
@@ -84,7 +84,7 @@ packages:
8484
name: meta
8585
url: "https://pub.dartlang.org"
8686
source: hosted
87-
version: "1.3.0-nullsafety.5"
87+
version: "1.3.0"
8888
mime:
8989
dependency: "direct main"
9090
description:
@@ -98,20 +98,20 @@ packages:
9898
name: path
9999
url: "https://pub.dartlang.org"
100100
source: hosted
101-
version: "1.7.0"
101+
version: "1.8.0"
102102
pedantic:
103103
dependency: "direct dev"
104104
description:
105105
name: pedantic
106106
url: "https://pub.dartlang.org"
107107
source: hosted
108-
version: "1.9.2"
108+
version: "1.10.0"
109109
typed_data:
110110
dependency: transitive
111111
description:
112112
name: typed_data
113113
url: "https://pub.dartlang.org"
114114
source: hosted
115-
version: "1.2.0"
115+
version: "1.3.0"
116116
sdks:
117-
dart: ">=2.10.0-0 <=2.12.0-259.8.beta"
117+
dart: ">=2.12.0-0 <3.0.0"

0 commit comments

Comments
 (0)
Please sign in to comment.