Skip to content

Commit

Permalink
🔖 release chopper v7.0.10, chopper_generator v7.0.7 (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse authored Dec 30, 2023
1 parent 9f3b2e7 commit aaaf482
Show file tree
Hide file tree
Showing 19 changed files with 261 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.6.0
# Created with package:mono_repo v6.6.1
name: Dart CI
on:
push:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: mono_repo self validate
run: dart pub global activate mono_repo 6.6.0
run: dart pub global activate mono_repo 6.6.1
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- run: git checkout HEAD^
Expand All @@ -53,7 +53,7 @@ jobs:
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load this version
id: load_this_version
working-directory: ${{ matrix.package }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_dry_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Load base version
Expand All @@ -50,7 +50,7 @@ jobs:
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load this version
id: load_this_version
working-directory: ${{ matrix.package }}
Expand Down
4 changes: 4 additions & 0 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.10

- Enable the user to specify non-String type header values by calling `.toString()` on any non-String Dart type. ([#538](https://github.com/lejard-h/chopper/pull/538))

## 7.0.9

- Add success/failure callback hooks to Authenticator ([#527](https://github.com/lejard-h/chopper/pull/527))
Expand Down
3 changes: 2 additions & 1 deletion chopper/example/definition.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chopper/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chopper
description: Chopper is an http client generator using source_gen, inspired by Retrofit
version: 7.0.9
version: 7.0.10
documentation: https://hadrien-lejard.gitbook.io/chopper
repository: https://github.com/lejard-h/chopper

Expand Down
33 changes: 33 additions & 0 deletions chopper/test/base_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:http/testing.dart';
import 'package:test/test.dart';
import 'package:transparent_image/transparent_image.dart';

import 'fixtures/example_enum.dart';
import 'test_service.dart';
import 'test_service_base_url.dart';
import 'test_service_variable.dart';
Expand Down Expand Up @@ -1616,4 +1617,36 @@ void main() {

httpClient.close();
});

test('headers are always stringified', () async {
final httpClient = MockClient((request) async {
expect(
request.url.toString(),
equals('$baseUrl/test/headers'),
);
expect(request.method, equals('GET'));
expect(request.headers['x-string'], equals('lorem'));
expect(request.headers['x-boolean'], equals('true'));
expect(request.headers['x-int'], equals('42'));
expect(request.headers['x-double'], equals('42.42'));
expect(request.headers['x-enum'], equals('baz'));

return http.Response('get response', 200);
});

final chopper = buildClient(httpClient, JsonConverter());
final service = chopper.getService<HttpTestService>();

final response = await service.getHeaders(
stringHeader: 'lorem',
boolHeader: true,
intHeader: 42,
doubleHeader: 42.42,
enumHeader: ExampleEnum.baz,
);

expect(response.statusCode, equals(200));

httpClient.close();
});
}
8 changes: 8 additions & 0 deletions chopper/test/fixtures/example_enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum ExampleEnum {
foo,
bar,
baz;

@override
String toString() => name;
}
28 changes: 27 additions & 1 deletion chopper/test/test_service.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions chopper/test/test_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'dart:convert';
import 'package:chopper/chopper.dart';
import 'package:http/http.dart' show MultipartFile;

import 'fixtures/example_enum.dart';

part 'test_service.chopper.dart';

@ChopperApi(baseUrl: '/test')
Expand Down Expand Up @@ -193,6 +195,15 @@ abstract class HttpTestService extends ChopperService {
Future<Response<String>> getDateTime(
@Query('value') DateTime value,
);

@Get(path: 'headers')
Future<Response<String>> getHeaders({
@Header('x-string') required String stringHeader,
@Header('x-boolean') bool? boolHeader,
@Header('x-int') int? intHeader,
@Header('x-double') double? doubleHeader,
@Header('x-enum') ExampleEnum? enumHeader,
});
}

Request customConvertRequest(Request req) {
Expand Down
3 changes: 2 additions & 1 deletion chopper/test/test_service_base_url.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chopper/test/test_service_variable.chopper.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions chopper_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.7

- Enable the user to specify non-String type header values by calling `.toString()` on any non-String Dart type. ([#538](https://github.com/lejard-h/chopper/pull/538))

## 7.0.6

- Fix incorrect url generation when using new baseUrl ([#520](https://github.com/lejard-h/chopper/pull/520))
Expand Down
Loading

0 comments on commit aaaf482

Please sign in to comment.