rhttp_curl_logger 0.1.0+1 copy "rhttp_curl_logger: ^0.1.0+1" to clipboard
rhttp_curl_logger: ^0.1.0+1 copied to clipboard

An interceptor for rhttp that prints the request as a single line cURL command

rhttp_curl_logger #

deploy codecov Pub Version GitHub License GitHub last commit Pub Points

A lightweight logger for the rhttp package that prints requests as cURL commands to your console for easy debugging and sharing.


πŸ“¦ Installation #

Add the package to your pubspec.yaml:

dev_dependencies:
  rhttp_curl_logger: ^0.1.0+1

πŸš€ Usage #

Use the RhttpCurlLogger interceptor in your rhttp client:

import 'package:rhttp_curl_logger/rhttp_curl_logger.dart';

final client = await RhttpClient.create(
  interceptors: [
    RhttpCurlLogger(
      useDoubleQuotes: true,    // default
      escapeQuotesInBody: true, // default
      multiline: false,         // default
      logName: 'curl_log',      // default
      logger: null,             // default
    ),
  ],
);

πŸ§ͺ Example #

  • Configuration:
final client = RHttpClient(
  interceptors: [
    RhttpCurlLogger(
      multiline: true,
      logName: 'rhttp',
      useDoubleQuotes: false,
    ),
  ],
);
  • Output sample:
[rhttp] curl -X POST
        -H 'content-type: application/json'
        -d '{"title":"foo","body":"bar","userId":1}'
        'https://jsonplaceholder.typicode.com/posts?foo=bar&baz=1'

If you find this package helpful, consider giving it a πŸ‘ on pub.flutter-io.cn or sharing it with others.

For bugs, or feature requests, feel free to open an issue

1
likes
160
points
10
downloads

Publisher

verified publisheralbinpk.dev

Weekly Downloads

An interceptor for rhttp that prints the request as a single line cURL command

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#curl #rhttp #interceptor #logging #rhttp-curl-logger

Documentation

API reference

License

MIT (license)

Dependencies

flutter, rhttp

More

Packages that depend on rhttp_curl_logger