LCOV - code coverage report
Current view: top level - http-0.11.3+15/lib/src - base_response.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 0 5 0.0 %
Date: 2017-10-10 20:17:03 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
       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.
       4             : 
       5             : import 'base_request.dart';
       6             : 
       7             : /// The base class for HTTP responses.
       8             : ///
       9             : /// Subclasses of [BaseResponse] are usually not constructed manually; instead,
      10             : /// they're returned by [BaseClient.send] or other HTTP client methods.
      11             : abstract class BaseResponse {
      12             :   /// The (frozen) request that triggered this response.
      13             :   final BaseRequest request;
      14             : 
      15             :   /// The status code of the response.
      16             :   final int statusCode;
      17             : 
      18             :   /// The reason phrase associated with the status code.
      19             :   final String reasonPhrase;
      20             : 
      21             :   /// The size of the response body, in bytes.
      22             :   ///
      23             :   /// If the size of the request is not known in advance, this is `null`.
      24             :   final int contentLength;
      25             : 
      26             :   // TODO(nweiz): automatically parse cookies from headers
      27             : 
      28             :   // TODO(nweiz): make this a HttpHeaders object.
      29             :   /// The headers for this response.
      30             :   final Map<String, String> headers;
      31             : 
      32             :   /// Whether this response is a redirect.
      33             :   final bool isRedirect;
      34             : 
      35             :   /// Whether the server requested that a persistent connection be maintained.
      36             :   final bool persistentConnection;
      37             : 
      38             :   /// Creates a new HTTP response.
      39             :   BaseResponse(
      40             :       this.statusCode,
      41             :       {this.contentLength,
      42             :        this.request,
      43             :        this.headers: const {},
      44             :        this.isRedirect: false,
      45             :        this.persistentConnection: true,
      46           0 :        this.reasonPhrase}) {
      47           0 :     if (statusCode < 100) {
      48           0 :       throw new ArgumentError("Invalid status code $statusCode.");
      49           0 :     } else if (contentLength != null && contentLength < 0) {
      50           0 :       throw new ArgumentError("Invalid content length $contentLength.");
      51             :     }
      52             :   }
      53             : }

Generated by: LCOV version 1.13