LCOV - code coverage report
Current view: top level - lib/src - agattp_request.dart (source / functions) Coverage Total Hit
Test: agattp Lines: 0.0 % 3 0
Test Date: 2025-01-28 00:11:13 Functions: - 0 0

            Line data    Source code
       1              : import 'package:agattp/src/agattp_config.dart';
       2              : import 'package:agattp/src/agattp_method.dart';
       3              : import 'package:agattp/src/agattp_response.dart';
       4              : 
       5              : /// An interface to standardize HTTP requests with a given config
       6              : abstract class AgattpRequestInterface<T, R extends AgattpResponse> {
       7              :   /// The config to use when making the request
       8              :   AgattpConfig get config;
       9              : 
      10              :   /// Actually send the request and return a Future with the response
      11              :   Future<R> send({
      12              :     required AgattpMethod method,
      13              :     required Uri uri,
      14              :     required String? body,
      15              :     required Duration? timeout,
      16              :     Map<String, String> headers = const <String, String>{},
      17              :   });
      18              : }
      19              : 
      20              : /// A concrete implementation of the Request interface that stubs the send call
      21              : /// to throw an UnimplementedError, in case the native or web implementations
      22              : /// are not called for whatever reason
      23              : class AgattpRequest<T, R extends AgattpResponse>
      24              :     implements AgattpRequestInterface<T, R> {
      25              :   @override
      26              :   final AgattpConfig config;
      27              : 
      28            0 :   AgattpRequest(this.config);
      29              : 
      30            0 :   @override
      31              :   Future<R> send({
      32              :     required AgattpMethod method,
      33              :     required Uri uri,
      34              :     required String? body,
      35              :     required Duration? timeout,
      36              :     Map<String, String> headers = const <String, String>{},
      37              :   }) async {
      38              :     // The stub implementation throws an error since no implementation is
      39              :     // provided - likely missing an implementation like native / web
      40            0 :     throw UnimplementedError('AgattpStubCall.send() is not implemented.');
      41              :   }
      42              : }
        

Generated by: LCOV version 2.0-1