From acd6fe849edbb4d516c0c50360179134c4b3aaff Mon Sep 17 00:00:00 2001 From: Javad Zobeidi Date: Sun, 3 Mar 2024 17:39:48 +0330 Subject: [PATCH] Fixed bug: http method options and cros error --- CHANGELOG.md | 6 +++++- lib/src/database/migration.dart | 2 +- lib/src/http/request/request.dart | 2 +- lib/src/route/route_handler.dart | 4 ++-- pubspec.yaml | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0057c6d..5b9b667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## 0.1.1 +## 0.1.1+1 + +- Fixed bug: http method options and cros error + +- ## 0.1.1 - Added Hash class diff --git a/lib/src/database/migration.dart b/lib/src/database/migration.dart index 0f56e44..c11d922 100644 --- a/lib/src/database/migration.dart +++ b/lib/src/database/migration.dart @@ -205,6 +205,7 @@ class Migration { void id() { bigIncrements('id'); + primary('id'); } void bigIncrements( @@ -231,7 +232,6 @@ class Migration { virtuality: virtuality, increment: true, ); - primary(name); } void integer( diff --git a/lib/src/http/request/request.dart b/lib/src/http/request/request.dart index 4d4b937..5f7f252 100644 --- a/lib/src/http/request/request.dart +++ b/lib/src/http/request/request.dart @@ -190,7 +190,7 @@ class Request { return _query.values; } - if (_query[key]) { + if (_query[key] != null) { return _query[key]; } diff --git a/lib/src/route/route_handler.dart b/lib/src/route/route_handler.dart index 49bc23e..77f10fe 100644 --- a/lib/src/route/route_handler.dart +++ b/lib/src/route/route_handler.dart @@ -14,8 +14,8 @@ Future httpRouteHandler(HttpRequest req) async { req.headers.value(HttpHeaders.hostHeader), ); if (route == null) { - if (req.method == HttpRequestMethod.options.name) { - req.response.statusCode = HttpStatus.ok; + if (req.method.toLowerCase() == + HttpRequestMethod.options.name.toLowerCase()) { req.response.close(); return null; } else { diff --git a/pubspec.yaml b/pubspec.yaml index 09f8e24..d5b3f69 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: vania description: Fast, simple, and powerful backend framework for Dart built with ❤️ -version: 0.1.1 +version: 0.1.1+1 homepage: https://vdart.dev repository: https://github.com/vania-dart/framework issue_tracker: https://github.com/vania-dart/framework/issues