From 76532f9509571d29ed84d973c53e9660ef76f6f4 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Nov 2018 21:37:00 -0500 Subject: [PATCH] Allow redir to Uri --- CHANGELOG.md | 1 + lib/src/core/response_context.dart | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8545e00..98e5ca69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 2.0.0-alpha.11 * Add `readMany` to `Service`. +* Allow `ResponseContext.redirect` to take a `Uri`. # 2.0.0-alpha.10 * All calls to `Service.parseId` are now affixed with the `` argument. diff --git a/lib/src/core/response_context.dart b/lib/src/core/response_context.dart index a1011815..a76aaccf 100644 --- a/lib/src/core/response_context.dart +++ b/lib/src/core/response_context.dart @@ -175,8 +175,8 @@ abstract class ResponseContext if (!isOpen) throw closed(); headers ..['content-type'] = 'text/html' - ..['location'] = url is String - ? url + ..['location'] = (url is String || url is Uri) + ? url.toString() : app.navigate(url as Iterable, absolute: absolute); statusCode = code ?? 302; write('''