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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 48283002: Throw exception when trying to modify HTTP status code when header is already sent (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/http_headers_state_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 42b8d6f80b16130378023831ef41427c87eaa0f6..fcd9a0621d831186dc1cbb77d51b2dc3c6850d73 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -697,7 +697,7 @@ class _BufferTransformer implements StreamTransformer<List<int>, List<int>> {
class _HttpResponse extends _HttpOutboundMessage<HttpResponse>
implements HttpResponse {
- int statusCode = 200;
+ int _statusCode = 200;
String _reasonPhrase;
List<Cookie> _cookies;
_HttpRequest _httpRequest;
@@ -717,6 +717,12 @@ class _HttpResponse extends _HttpOutboundMessage<HttpResponse>
return _cookies;
}
+ int get statusCode => _statusCode;
+ void set statusCode(int statusCode) {
+ if (_headersWritten) throw new StateError("Header already sent");
+ _statusCode = statusCode;
+ }
+
String get reasonPhrase => _findReasonPhrase(statusCode);
void set reasonPhrase(String reasonPhrase) {
if (_headersWritten) throw new StateError("Header already sent");
« no previous file with comments | « no previous file | tests/standalone/io/http_headers_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698