cors_validator 0.0.1 copy "cors_validator: ^0.0.1" to clipboard
cors_validator: ^0.0.1 copied to clipboard

Cors validator package

cors_validator #

This package offers a simple way to validate CORS in Flutter/Dart applications. It allows you to choose between two popular HTTP request libraries: Dio or http.

Instalation #

Add the dependency to your pubspec.yaml:

dev_dependencies:
  cors_validator: ^0.0.1

How use in your application #

import 'package:cors_validator/cors_validator.dart';
import 'package:cors_validator/src/package_requisition_enum.dart';

void main() async {
  final validateCors = CorsValidatorFactory.create(
    PackageRequisitionEnum.dio, // ou PackageRequisitionEnum.http
    'https://example.com',
  );

  final result = await validateCors('https://example.com');

  if (result.isValid) {
    print('CORS is valid: ${result.statusCode}');
  } else {
    print('CORS validation failed: ${result.errorMessage}');
  }
}
0
likes
130
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

Cors validator package

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

GPL-3.0 (license)

Dependencies

dio, flutter, http

More

Packages that depend on cors_validator