Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: lib/src/util.dart

Issue 851423003: Request now has the same body model as Response (Closed) Base URL: https://github.com/dart-lang/shelf.git@master
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/response.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library shelf.util; 5 library shelf.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 10
(...skipping 22 matching lines...) Expand all
33 /// 33 ///
34 /// For keys that are the same between [original] and [updates], the value in 34 /// For keys that are the same between [original] and [updates], the value in
35 /// [updates] is used. 35 /// [updates] is used.
36 /// 36 ///
37 /// If [updates] is `null` or empty, [original] is returned unchanged. 37 /// If [updates] is `null` or empty, [original] is returned unchanged.
38 Map updateMap(Map original, Map updates) { 38 Map updateMap(Map original, Map updates) {
39 if (updates == null || updates.isEmpty) return original; 39 if (updates == null || updates.isEmpty) return original;
40 40
41 return new Map.from(original)..addAll(updates); 41 return new Map.from(original)..addAll(updates);
42 } 42 }
43
44 /// Adds a header with [name] and [value] to [headers], which may be null.
45 ///
46 /// Returns a new map without modifying [headers].
47 Map<String, String> addHeader(
48 Map<String, String> headers, String name, String value) {
49 headers = headers == null ? {} : new Map.from(headers);
50 headers[name] = value;
51 return headers;
52 }
OLDNEW
« no previous file with comments | « lib/src/response.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698