| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.body; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 import 'dart:convert'; | 6 import 'dart:convert'; |
| 9 | 7 |
| 10 /// The body of a request or response. | 8 /// The body of a request or response. |
| 11 /// | 9 /// |
| 12 /// This tracks whether the body has been read. It's separate from [Message] | 10 /// This tracks whether the body has been read. It's separate from [Message] |
| 13 /// because the message may be changed with [Message.change], but each instance | 11 /// because the message may be changed with [Message.change], but each instance |
| 14 /// should share a notion of whether the body was read. | 12 /// should share a notion of whether the body was read. |
| 15 class Body { | 13 class Body { |
| 16 /// The contents of the message body. | 14 /// The contents of the message body. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 Stream<List<int>> read() { | 49 Stream<List<int>> read() { |
| 52 if (_stream == null) { | 50 if (_stream == null) { |
| 53 throw new StateError("The 'read' method can only be called once on a " | 51 throw new StateError("The 'read' method can only be called once on a " |
| 54 "shelf.Request/shelf.Response object."); | 52 "shelf.Request/shelf.Response object."); |
| 55 } | 53 } |
| 56 var stream = _stream; | 54 var stream = _stream; |
| 57 _stream = null; | 55 _stream = null; |
| 58 return stream; | 56 return stream; |
| 59 } | 57 } |
| 60 } | 58 } |
| OLD | NEW |