From 1399dbca3a38d3af7d5eacf9bd1a6d58080ca121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 28 Mar 2022 20:37:27 +0200 Subject: [PATCH] =?UTF-8?q?Spr=C3=A1vn=C4=9B=20kontrolovat=20status=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ lib/src/canteen.dart | 3 ++- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1ee111..2042be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.0-alpha.3 +- Kontrolovat správný status kód u GET požadavků + ## 0.1.0-alpha.2 - Nevytvářet debugovací soubor - Místo ziskejKredit používáme ziskejUzivatele (Třída Uzivatel) diff --git a/lib/src/canteen.dart b/lib/src/canteen.dart index 3a99114..9f6fbd8 100644 --- a/lib/src/canteen.dart +++ b/lib/src/canteen.dart @@ -122,6 +122,7 @@ class Canteen { if (res.headers['set-cookie']!.contains("remember-me=;")) { return false; // špatné heslo } + print(res.statusCode); if (res.statusCode != 302) { throw Exception("Chyba: ${res.body}"); } @@ -144,7 +145,7 @@ class Canteen { ? "; " + cookies["remember-me"]! + ";" : ";"), }); - if (r.statusCode != 302) { + if (r.statusCode != 200) { throw Exception("Chyba: ${r.body}"); } if (r.headers.containsKey("set-cookie")) { diff --git a/pubspec.yaml b/pubspec.yaml index 3381ed1..06efd9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: canteenlib description: Knihovna pro komunikaci se stravovacím systémem iCanteen -version: 0.1.0-alpha.2 +version: 0.1.0-alpha.3 repository: 'https://github.com/hernikplays/canteenlib' issue_tracker: 'https://github.com/hernikplays/canteenlib/issues'