diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c041f8..435fa0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: version: ${{ steps.version-step.outputs.version }} steps: - name: Code Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get Pubspec Version id: version-step @@ -23,6 +23,15 @@ jobs: export VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+') echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Check if version is used + run: | + URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest + LATEST=$(curl --silent "$URL" | jq -r .name) + if [ "$LATEST" == "v$VERSION" ]; then + echo "Version already used: $VERSION" + exit 1 + fi + ################### # Tests & Release # @@ -36,7 +45,7 @@ jobs: contents: write steps: - name: Code Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Flutter Environment uses: subosito/flutter-action@v2 @@ -64,10 +73,10 @@ jobs: - name: Creating lcov.info run: | dart run coverage:format_coverage \ - --packages=coverage/package.json \ - --lcov \ - -i coverage \ - -o coverage/lcov.info + --packages=coverage/package.json \ + --lcov \ + -i coverage \ + -o coverage/lcov.info - name: Creating Test Coverage HTML run: | @@ -80,7 +89,7 @@ jobs: run: dart run helpers/create_index.dart README.md coverage/html/index.html - name: Publish Dart Package - uses: k-paxian/dart-package-publisher@master + uses: k-paxian/dart-package-publisher@1.6 with: accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }} refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }} @@ -88,13 +97,13 @@ jobs: format: true - name: Publishing to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: publish_dir: ./coverage/html github_token: ${{ secrets.GITHUB_TOKEN }} - name: Creating a GitHub Tag - uses: mathieudutour/github-tag-action@v6.1 + uses: mathieudutour/github-tag-action@v6.2 with: custom_tag: ${{ needs.boot.outputs.version }} github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 286d938..574091f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: timeout-minutes: 20 steps: - name: Code Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Flutter Environment uses: subosito/flutter-action@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index d724434..73cddba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ +## 0.2.0 (2024-05-26) + +- Updating dependencies. + ## 0.1.2 (2023-06-29) - Removing http package dependency. -- Adding testainer package. +- Adding testainers package. ## 0.1.1 (2023-06-24) diff --git a/README.md b/README.md index a36af4f..0bf8dfd 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,74 @@ # curt -Simple wrapper for curl in dart. +[![Build With Love](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg)](https://github.com/edufolly/curt/stargazers) +[![Pub Package](https://img.shields.io/pub/v/curt?color=orange)](https://pub.dev/packages/curt) +[![Licence](https://img.shields.io/github/license/edufolly/curt?color=blue)](https://github.com/edufolly/curt/blob/main/LICENSE) +[![Build](https://img.shields.io/github/actions/workflow/status/edufolly/curt/main.yml?branch=main)](https://github.com/edufolly/curt/releases/latest) +[![Coverage Report](https://img.shields.io/badge/coverage-report-C08EA1)](https://edufolly.github.io/curt/coverage/) -[![BuildWithLove](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg "build with love")](https://github.com/edufolly/curt/stargazers) -[![pub package](https://img.shields.io/pub/v/curt?include_prereleases.svg "curt")](https://pub.dev/packages/curt) -[![curt](https://img.shields.io/github/license/edufolly/curt "licence")](https://github.com/edufolly/curt) -[![curt](https://img.shields.io/github/actions/workflow/status/edufolly/curt/main.yml?branch=main "build")](https://github.com/edufolly/curt) -[![CoverageReport](https://img.shields.io/badge/coverage-report-blue "coverage report")](https://edufolly.github.io/curt/coverage/) +A convenient package that allows developers to interact with the curl command +within elegance of the Dart programming language. -## Motivation - -Allow https connections with TLS less than 1.2 through curl. +This wrapper simplifies the process of sending HTTP requests, handling +responses, and managing data transfers, providing a more intuitive and efficient +way to work with curl functionality in the Dart ecosystem. By encapsulating the +complexity of curl within a straightforward wrapper, developers can leverage its +power and flexibility while benefiting from the simplicity and elegance of the +Dart programming language. ## Funding +Your contribution will help drive the development of quality tools for the +Flutter and Dart developer community. Any amount will be appreciated. Thank you +for your continued support! + [![BuyMeACoffee](https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg)](https://www.buymeacoffee.com/edufolly) -### Code Example +## PIX + +Sua contribuição ajudará a impulsionar o desenvolvimento de ferramentas de +qualidade para a comunidade de desenvolvedores Flutter e Dart. Qualquer quantia +será apreciada. Obrigado pelo seu apoio contínuo! + +[![PIX](helpers/pix.png)](https://nubank.com.br/pagar/2bt2q/RBr4Szfuwr) + +## Motivation + +Allow https connections with TLS less than 1.2 through [curl](https://curl.se/). + +Legacy systems or older applications that rely on older TLS versions for +compatibility reasons. These systems might not have been upgraded to support TLS +1.2 or higher due to various constraints, such as limited resources, technical +limitations, or compatibility issues with certain dependencies. In such cases, +allowing HTTPS connections with TLS versions less than 1.2 through curl would +enable these systems to continue functioning without major modifications. + +Certain devices or environments might enforce outdated TLS configurations due to +specific security policies or restrictions. These networks may still rely on +older TLS versions for various reasons, such as interoperability with legacy +systems or compliance with specific regulations. Allowing curl to establish +HTTPS connections with TLS versions less than 1.2 would ensure compatibility and +connectivity in these constrained environments. + +However, it's important to note that TLS versions prior to 1.2 (such as TLS 1.0 +and TLS 1.1) are considered less secure and potentially vulnerable to various +security threats. TLS 1.2 introduced significant improvements in terms of +security, encryption algorithms, and cryptographic protocols. Therefore, it's +generally recommended to use TLS 1.2 or higher for secure communications. + +## Example + +```dart +import 'package:curt/curt.dart'; -https://github.com/edufolly/curt/blob/main/example/curt_example.dart +/// +/// +/// +void main() async { + final Curt curt = Curt(); + final CurtResponse response = await curt.get(Uri.parse('https://google.com')); + print('Status Code: ${response.statusCode}'); + print('Headers: ${response.headers}'); + print('Body:\n${response.body}'); +} +``` diff --git a/analysis_options.yaml b/analysis_options.yaml index b5dd5ad..54bc37b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,16 +1,34 @@ include: package:lints/recommended.yaml -# https://dart.dev/guides/language/analysis-options +# https://dart.dev/tools/analysis -# https://dart-lang.github.io/linter/lints/options/options.html +analyze: + language: + strict-casts: true + strict-inference: true + strict-raw-types: true + strong-mode: + implicit-casts: false + +# https://dart.dev/tools/linter-rules/all linter: rules: always_declare_return_types: true always_put_control_body_on_new_line: true always_put_required_named_parameters_first: true + + # Incompatible with: + # avoid_types_on_closure_parameters + # omit_local_variable_types always_specify_types: true + + + # Incompatible with: + # prefer_relative_imports always_use_package_imports: true + annotate_overrides: true + annotate_redeclares: true avoid_annotating_with_dynamic: false avoid_bool_literals_in_conditional_expressions: true avoid_catches_without_on_clauses: true @@ -22,7 +40,11 @@ linter: avoid_equals_and_hash_code_on_mutable_classes: true avoid_escaping_inner_quotes: true avoid_field_initializers_in_const_classes: true + + # Incompatible with: + # prefer_final_parameters avoid_final_parameters: true + avoid_function_literals_in_foreach_calls: true avoid_implementing_value_types: true avoid_init_to_null: true @@ -44,7 +66,11 @@ linter: avoid_slow_async_io: true avoid_type_to_string: true avoid_types_as_parameter_names: true + + # Incompatible with: + # always_specify_types avoid_types_on_closure_parameters: false + avoid_unnecessary_containers: true avoid_unused_constructor_parameters: true avoid_void_async: true @@ -92,6 +118,7 @@ linter: lines_longer_than_80_chars: true literal_only_boolean_expressions: true matching_super_parameters: true + missing_code_block_language_in_doc_comment: true missing_whitespace_between_adjacent_strings: true no_adjacent_strings_in_list: true no_default_cases: true @@ -101,11 +128,17 @@ linter: no_literal_bool_comparisons: true no_logic_in_create_state: true no_runtimeType_toString: true + no_self_assignments: true + no_wildcard_variable_uses: true non_constant_identifier_names: true noop_primitive_operations: true null_check_on_nullable_type_parameter: true null_closures: true + + # Incompatible with: + # always_specify_types omit_local_variable_types: false + one_member_abstracts: true only_throw_errors: true overridden_fields: true @@ -124,12 +157,25 @@ linter: prefer_const_literals_to_create_immutables: true prefer_constructors_over_static_methods: true prefer_contains: true + + # Incompatible with: + # prefer_single_quotes prefer_double_quotes: false + prefer_expression_function_bodies: false prefer_final_fields: true prefer_final_in_for_each: true + + # Incompatible with: + # unnecessary_final prefer_final_locals: true + + + # Incompatible with: + # unnecessary_final + # avoid_final_parameters prefer_final_parameters: false + prefer_for_elements_to_map_fromIterable: true prefer_foreach: true prefer_function_declarations_over_variables: true @@ -147,8 +193,16 @@ linter: prefer_mixin: true prefer_null_aware_method_calls: true prefer_null_aware_operators: true + + # Incompatible with: + # always_use_package_imports prefer_relative_imports: false + + + # Incompatible with: + # prefer_double_quotes prefer_single_quotes: true + prefer_spread_collections: true prefer_typing_uninitialized_variables: true prefer_void_to_null: true @@ -176,11 +230,17 @@ linter: unnecessary_breaks: true unnecessary_const: true unnecessary_constructor_name: true + + # Incompatible with: + # prefer_final_locals + # prefer_final_parameters unnecessary_final: false + unnecessary_getters_setters: true unnecessary_lambdas: true unnecessary_late: true unnecessary_library_directive: true + unnecessary_library_name: false unnecessary_new: true unnecessary_null_aware_assignments: true unnecessary_null_aware_operator_on_extension_on_nullable: true diff --git a/helpers/create_index.dart b/helpers/create_index.dart index 06eea24..e2af42b 100644 --- a/helpers/create_index.dart +++ b/helpers/create_index.dart @@ -17,6 +17,7 @@ void main(List args) { if (!mdFile.existsSync()) { print('Markdown file not exists.'); + exit(20); } const String template = ''' diff --git a/helpers/pix.png b/helpers/pix.png new file mode 100644 index 0000000..15dbaa0 Binary files /dev/null and b/helpers/pix.png differ diff --git a/pubspec.yaml b/pubspec.yaml index 01dee36..cf1623c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: curt -description: Simple wrapper for curl in dart. -version: 0.1.2 +description: A convenient package that allows developers to interact with the curl command within elegance of the Dart programming language. +version: 0.2.0 repository: https://github.com/edufolly/curt environment: @@ -11,16 +11,16 @@ dependencies: dev_dependencies: # https://pub.dev/packages/coverage - coverage: ^1.6.3 + coverage: ^1.8.0 # https://pub.dev/packages/lints - lints: ^2.1.0 + lints: ^4.0.0 # https://pub.dev/packages/markdown - markdown: ^7.1.0 + markdown: ^7.2.2 # https://pub.dev/packages/test - test: ^1.24.0 + test: ^1.25.5 # https://pub.dev/packages/testainers - testainers: ^0.0.1 + testainers: ^0.1.1 diff --git a/test/curt_test.dart b/test/curt_test.dart index 3aa788f..4f12d13 100644 --- a/test/curt_test.dart +++ b/test/curt_test.dart @@ -9,173 +9,202 @@ import 'package:testainers/testainers.dart'; /// /// void main() { + /// + group('Online Tests', () { + final Curt curt = Curt(); + + test('GET https://google.com', () async { + final CurtResponse response = await curt.get( + Uri.parse('https://google.com'), + ); + expect(response.statusCode, 301); + expect(response.headers, isNotEmpty); + expect(response.body, isNotEmpty); + }); + }); + /// group( - 'Basic Tests', + 'Local Tests', () { final Curt curt = Curt(); - final TestainersHttpBin container = TestainersHttpBin(); + final Curt insecure = Curt(insecure: true); + + final Curt followRedirects = Curt(followRedirects: true); - const String scheme = 'http'; - const String server = '127.0.0.1'; + final TestainersHttpbucket container = TestainersHttpbucket(); + + const Map headers = { + 'Content-Type': 'application/json; charset=utf-8', + }; + + const String server = 'localhost'; /// setUpAll(() async { await container.start(); }); - test('GET $scheme://$server:${container.httpPort}/status/200', () async { + test('GET HTTP 200', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/status/200'), + Uri.parse('http://$server:${container.httpPort}/status/200'), ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('GET $scheme://$server:${container.httpPort}/status/403', () async { + test('GET HTTP 403', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/status/403'), + Uri.parse('http://$server:${container.httpPort}/status/403'), ); expect(response.statusCode, 403); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('GET $scheme://$server:${container.httpPort}/status/404', () async { + test('GET HTTP 404', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/status/404'), + Uri.parse('http://$server:${container.httpPort}/status/404'), ); expect(response.statusCode, 404); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('GET $scheme://$server:${container.httpPort}/status/500', () async { + test('GET HTTP 500', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/status/500'), + Uri.parse('http://$server:${container.httpPort}/status/500'), ); expect(response.statusCode, 500); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('POST $scheme://$server:${container.httpPort}/status/200', () async { + test('POST HTTP 200', () async { final CurtResponse response = await curt.post( - Uri.parse('$scheme://$server:${container.httpPort}/status/200'), + Uri.parse('http://$server:${container.httpPort}/status/200'), + headers: headers, ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('POST $scheme://$server:${container.httpPort}/status/403', () async { + test('POST HTTP 403', () async { final CurtResponse response = await curt.post( - Uri.parse('$scheme://$server:${container.httpPort}/status/403'), + Uri.parse('http://$server:${container.httpPort}/status/403'), + headers: headers, ); expect(response.statusCode, 403); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('POST $scheme://$server:${container.httpPort}/status/404', () async { + test('POST HTTP 404', () async { final CurtResponse response = await curt.post( - Uri.parse('$scheme://$server:${container.httpPort}/status/404'), + Uri.parse('http://$server:${container.httpPort}/status/404'), + headers: headers, ); expect(response.statusCode, 404); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('POST $scheme://$server:${container.httpPort}/status/500', () async { + test('POST HTTP 500', () async { final CurtResponse response = await curt.post( - Uri.parse('$scheme://$server:${container.httpPort}/status/500'), + Uri.parse('http://$server:${container.httpPort}/status/500'), + headers: headers, ); expect(response.statusCode, 500); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('PUT $scheme://$server:${container.httpPort}/status/200', () async { + test('PUT HTTP 200', () async { final CurtResponse response = await curt.put( - Uri.parse('$scheme://$server:${container.httpPort}/status/200'), + Uri.parse('http://$server:${container.httpPort}/status/200'), + headers: headers, ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('PUT $scheme://$server:${container.httpPort}/status/403', () async { + test('PUT HTTP 403', () async { final CurtResponse response = await curt.put( - Uri.parse('$scheme://$server:${container.httpPort}/status/403'), + Uri.parse('http://$server:${container.httpPort}/status/403'), + headers: headers, ); expect(response.statusCode, 403); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('PUT $scheme://$server:${container.httpPort}/status/404', () async { + test('PUT HTTP 404', () async { final CurtResponse response = await curt.put( - Uri.parse('$scheme://$server:${container.httpPort}/status/404'), + Uri.parse('http://$server:${container.httpPort}/status/404'), + headers: headers, ); expect(response.statusCode, 404); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('PUT $scheme://$server:${container.httpPort}/status/500', () async { + test('PUT HTTP 500', () async { final CurtResponse response = await curt.put( - Uri.parse('$scheme://$server:${container.httpPort}/status/500'), + Uri.parse('http://$server:${container.httpPort}/status/500'), + headers: headers, ); expect(response.statusCode, 500); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('DELETE $scheme://$server:${container.httpPort}/status/200', - () async { + test('DELETE HTTP 200', () async { final CurtResponse response = await curt.delete( - Uri.parse('$scheme://$server:${container.httpPort}/status/200'), + Uri.parse('http://$server:${container.httpPort}/status/200'), + headers: headers, ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('DELETE $scheme://$server:${container.httpPort}/status/403', - () async { + test('DELETE HTTP 403', () async { final CurtResponse response = await curt.delete( - Uri.parse('$scheme://$server:${container.httpPort}/status/403'), + Uri.parse('http://$server:${container.httpPort}/status/403'), + headers: headers, ); expect(response.statusCode, 403); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('DELETE $scheme://$server:${container.httpPort}/status/404', - () async { + test('DELETE HTTP 404', () async { final CurtResponse response = await curt.delete( - Uri.parse('$scheme://$server:${container.httpPort}/status/404'), + Uri.parse('http://$server:${container.httpPort}/status/404'), + headers: headers, ); expect(response.statusCode, 404); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); - test('DELETE $scheme://$server:${container.httpPort}/status/500', - () async { + test('DELETE HTTP 500', () async { final CurtResponse response = await curt.delete( - Uri.parse('$scheme://$server:${container.httpPort}/status/500'), + Uri.parse('http://$server:${container.httpPort}/status/500'), + headers: headers, ); expect(response.statusCode, 500); expect(response.headers, isNotEmpty); - expect(response.body, isEmpty); + expect(response.body, isNotEmpty); }); test('Body Length 123', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/range/123'), + Uri.parse('http://$server:${container.httpPort}/length/123'), ); expect(response.statusCode, 200); @@ -187,7 +216,7 @@ void main() { test('Body Length 321', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/range/321'), + Uri.parse('http://$server:${container.httpPort}/length/321'), ); expect(response.statusCode, 200); @@ -197,103 +226,63 @@ void main() { expect(response.body.length, 321); }); - test('Body Length 999', () async { + test('Body Length 1024', () async { final CurtResponse response = await curt.get( - Uri.parse('$scheme://$server:${container.httpPort}/range/999'), + Uri.parse('http://$server:${container.httpPort}/length/1024'), ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); - expect(response.headers.contentLength, 999); + expect(response.headers.contentLength, 1024); expect(response.body, isNotEmpty); - expect(response.body.length, 999); + expect(response.body.length, 1024); }); - test('Redirect', () async { - final Curt curt = Curt(followRedirects: true); - + test('Redirect with no follow', () async { final Uri uri = Uri( - scheme: scheme, + scheme: 'http', host: server, port: container.httpPort, - path: 'redirect-to', + path: 'redirect', queryParameters: { - 'url': '$scheme://$server:${container.httpPort}/status/200', + 'url': 'http://$server:${container.httpPort}/status/200', }, ); final CurtResponse response = await curt.get(uri); - expect(response.statusCode, 200); + expect(response.statusCode, 302); expect(response.headers, isNotEmpty); - expect(response.headers.value(HttpHeaders.locationHeader), isNull); + expect( + response.headers.value(HttpHeaders.locationHeader), + uri.queryParameters['url'], + ); expect(response.body, isEmpty); }); - /// - tearDownAll(container.stop); - }, - onPlatform: { - 'mac-os': const Skip('No docker installed on GitHub actions.'), - 'windows': const Skip('Need a windows container image.'), - }, - ); - - /// - group( - 'Basic Local Tests', - () { - final Curt curt = Curt(insecure: true); - - final TestainersHttpHttpsEcho container = TestainersHttpHttpsEcho(); - - const String server = '127.0.0.1'; - - /// - setUpAll(() async { - await container.start(); - }); - - /// - test('Simple HTTP GET', () async { - final CurtResponse response = - await curt.get(Uri.parse('http://$server:${container.httpPort}/')); - expect(response.statusCode, 200); - expect(response.headers, isNotEmpty); - expect(response.body, isNotEmpty); - }); - - /// - test('Simple HTTP POST', () async { - final CurtResponse response = - await curt.post(Uri.parse('http://$server:${container.httpPort}/')); - expect(response.statusCode, 200); - expect(response.headers, isNotEmpty); - expect(response.body, isNotEmpty); - }); + test('Redirect', () async { + final Uri uri = Uri( + scheme: 'http', + host: server, + port: container.httpPort, + path: 'redirect', + queryParameters: { + 'url': 'http://$server:${container.httpPort}/status/200', + }, + ); - /// - test('Simple HTTP PUT', () async { - final CurtResponse response = - await curt.put(Uri.parse('http://$server:${container.httpPort}/')); - expect(response.statusCode, 200); - expect(response.headers, isNotEmpty); - expect(response.body, isNotEmpty); - }); + final CurtResponse response = await followRedirects.get(uri); - /// - test('Simple HTTP DELETE', () async { - final CurtResponse response = await curt - .delete(Uri.parse('http://$server:${container.httpPort}/')); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); + expect(response.headers.value(HttpHeaders.locationHeader), isNull); expect(response.body, isNotEmpty); }); - /// test('Simple HTTPS GET', () async { - final CurtResponse response = await curt - .get(Uri.parse('https://$server:${container.httpsPort}/')); + final CurtResponse response = await insecure.get( + Uri.parse('https://$server:${container.httpsPort}/status/200'), + ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); expect(response.body, isNotEmpty); @@ -301,8 +290,10 @@ void main() { /// test('Simple HTTPS POST', () async { - final CurtResponse response = await curt - .post(Uri.parse('https://$server:${container.httpsPort}/')); + final CurtResponse response = await insecure.post( + Uri.parse('https://$server:${container.httpsPort}/status/200'), + headers: headers, + ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); expect(response.body, isNotEmpty); @@ -310,8 +301,10 @@ void main() { /// test('Simple HTTPS PUT', () async { - final CurtResponse response = await curt - .put(Uri.parse('https://$server:${container.httpsPort}/')); + final CurtResponse response = await insecure.put( + Uri.parse('https://$server:${container.httpsPort}/status/200'), + headers: headers, + ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); expect(response.body, isNotEmpty); @@ -319,8 +312,10 @@ void main() { /// test('Simple HTTPS DELETE', () async { - final CurtResponse response = await curt - .delete(Uri.parse('https://$server:${container.httpsPort}/')); + final CurtResponse response = await insecure.delete( + Uri.parse('https://$server:${container.httpsPort}/status/200'), + headers: headers, + ); expect(response.statusCode, 200); expect(response.headers, isNotEmpty); expect(response.body, isNotEmpty);