| Index: pkg/shelf/lib/src/request.dart
|
| diff --git a/pkg/shelf/lib/src/request.dart b/pkg/shelf/lib/src/request.dart
|
| index f7e011dc42609321c775d6d8ecc9bc7af582e78a..57f255e975fdc87b906bab5c19dfcb56a32493e1 100644
|
| --- a/pkg/shelf/lib/src/request.dart
|
| +++ b/pkg/shelf/lib/src/request.dart
|
| @@ -81,8 +81,7 @@ class Request extends Message {
|
| headers: headers, context: context) {
|
| if (method.isEmpty) throw new ArgumentError('method cannot be empty.');
|
|
|
| - // TODO(kevmoo) use isAbsolute property on Uri once Issue 18053 is fixed
|
| - if (requestedUri.scheme.isEmpty) {
|
| + if (!requestedUri.isAbsolute) {
|
| throw new ArgumentError('requstedUri must be an absolute URI.');
|
| }
|
|
|
| @@ -107,6 +106,27 @@ class Request extends Message {
|
| throw new ArgumentError('scriptName and url cannot both be empty.');
|
| }
|
| }
|
| +
|
| + /// Creates a new [Request] by copying existing values and applying specified
|
| + /// changes.
|
| + ///
|
| + /// New key-value pairs in [context] and [headers] will be added to the copied
|
| + /// [Request].
|
| + ///
|
| + /// If [context] or [headers] includes a key that already exists, the
|
| + /// key-value pair will replace the corresponding entry in the copied
|
| + /// [Request].
|
| + ///
|
| + /// All other context and header values from the [Request] will be included
|
| + /// in the copied [Request] unchanged.
|
| + Request change({Map<String, String> headers, Map<String, Object> context}) {
|
| + headers = updateMap(this.headers, headers);
|
| + context = updateMap(this.context, context);
|
| +
|
| + return new Request(this.method, this.requestedUri,
|
| + protocolVersion: this.protocolVersion, headers: headers, url: this.url,
|
| + scriptName: this.scriptName, body: this.read(), context: context);
|
| + }
|
| }
|
|
|
| /// Computes `url` from the provided [Request] constructor arguments.
|
|
|