Skip to content

Commit

Permalink
🔖 release v6.1.3 (#436)
Browse files Browse the repository at this point in the history
# chopper

## 6.1.3

* Add follow redirects to toHttpRequest (#430)
* Update http constraint to ">=0.13.0 <2.0.0" (#431)
* Add MultipartRequest log to CurlInterceptor (#435)

---

# chopper_built_value

## 1.2.2

* Update http constraint to ">=0.13.0 <2.0.0" (#431)

---

# example

* Update squadron example (#432)

---

# Github actions

* Add cleanup step to publish workflow (#434)

---------

Co-authored-by: Joran Dob <joran998@gmail.com>
Co-authored-by: Joseph, NamKung <nkw0608@gmail.com>
Co-authored-by: Klemen Tusar <techouse@gmail.com>
  • Loading branch information
3 people authored May 28, 2023
1 parent 6fc2062 commit 87fb6c5
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 60 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,9 @@ jobs:
- name: Skip publish
id: skip_publish
if: ${{ env.IS_VERSION_GREATER == 0 }}
run: echo "Skipping publish for ${{ matrix.package }} because the version is not greater than the one on pub.dev"
run: echo "Skipping publish for ${{ matrix.package }} because the version is not greater than the one on pub.dev"
- name: Cleanup
id: cleanup
if: ${{ always() }}
run: |
rm -rf "$XDG_CONFIG_HOME/dart/pub-credentials.json"
57 changes: 34 additions & 23 deletions chopper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Changelog

## 6.1.3

- Add follow redirects to toHttpRequest ([#430](https://github.com/lejard-h/chopper/pull/430))
- Update http constraint to ">=0.13.0 <2.0.0" ([#431](https://github.com/lejard-h/chopper/pull/431))
- Add MultipartRequest log to CurlInterceptor ([#435](https://github.com/lejard-h/chopper/pull/435))

## 6.1.2

- Packages upgrade, constraints upgrade

## 6.1.1

- EquatableMixin for Request, Response and PartValue

## 6.1.0
Expand Down Expand Up @@ -37,6 +45,7 @@
## 4.0.1

- Fix for the null safety support

## 4.0.0

- **Null safety support**
Expand Down Expand Up @@ -73,15 +82,15 @@

**Breaking change**
New way to handle errors
if (response.isSuccessful) {
final body = response.body;
} else {
final error = response.error;
}
if (response.isSuccessful) {
final body = response.body;
} else {
final error = response.error;
}

- Fix error handling by introducing `Response.error` getter
- Remove `onError` since every response are available via `onResponse` stream


## 2.5.0

- Unsuccessful response are not throw anymore, use `Response.isSuccessful` getter or `statusCode` instead
Expand All @@ -90,8 +99,8 @@ New way to handle errors
## 2.4.2

- Fix on JsonConverter
If content type header overrided using @Post(headers: {'content-type': '...'})
The converter won't add json header and won't apply json.encode if content type is not JSON
If content type header overrided using @Post(headers: {'content-type': '...'})
The converter won't add json header and won't apply json.encode if content type is not JSON

- add `bool override` on `applyHeader(s)` functions, true by default

Expand All @@ -107,8 +116,9 @@ New way to handle errors
`Response.base` is now a `BaseRequest` instead of a `Request`, which means that you can't do base.body now.
Please use Response.bodyBytes or Response.bodyString instead for non streaming case.
- Now supports streams !
- You can pass `Stream<List<int>>` as a body to a request
- You can also use `Stream<List<int>>` as the BodyType for the response, in this case the returned response will contain a stream in `body`.
- You can pass `Stream<List<int>>` as a body to a request
- You can also use `Stream<List<int>>` as the BodyType for the response, in this case the returned response will
contain a stream in `body`.
- Support passing `MutlipartFile` (from packages:http) directly to `@FileField` annotation

## 2.3.2
Expand Down Expand Up @@ -138,12 +148,12 @@ New way to handle errors
## 2.2.0

- Fix converter issue on List
- ***Breaking Change***
on `Converter.convertResponse<ResultType>(response)`,
it take a new generic type => `Converter.convertResponse<ResultType, ItemType>(response)`
- ***Breaking Change***
on `Converter.convertResponse<ResultType>(response)`,
it take a new generic type => `Converter.convertResponse<ResultType, ItemType>(response)`

- deprecated `Chopper.service<Type>(Type)`, use `Chopper.getservice<Type>()` instead
thanks to @MichaelDark
thanks to @MichaelDark

## 2.1.0

Expand All @@ -159,30 +169,31 @@ thanks to @MichaelDark

- Request is now containing baseUrl
- Can call `Request.toHttpRequest()` direclty to get the `http.BaseRequest` will receive
- If a full url is specified in the `path` (ex: @Get(path: 'https://...')), it won't be concaten with the baseUrl of the ChopperClient and the ChopperAPI
- If a full url is specified in the `path` (ex: @Get(path: 'https://...')), it won't be concaten with the baseUrl of the
ChopperClient and the ChopperAPI
- Add `CurlInterceptor` thanks @edwardaux
- Add `HttpLoggingInterceptor`
- Add `FactoryConverter` annotation `@FactoryConverter(request: convertRequest, response: convertResponse)`

- ***BreakingChange***
- Method.url renamed to path
- `Converter.encode` and `Converter.decode` removed, implement `Converter.convertResponse` and Converter.convertRequest` instead
- `ChopperClient.jsonApi` deprecated, use a `JsonConverter` instead
- `ChopperClient.formUrlEncodedApi`, use `FormUrlEncodedConverter` instead
- remove `JsonEncoded` annotation, use `FactoryConverter` instead
- Method.url renamed to path
- `Converter.encode` and `Converter.decode` removed, implement `Converter.convertResponse` and
Converter.convertRequest` instead
- `ChopperClient.jsonApi` deprecated, use a `JsonConverter` instead
- `ChopperClient.formUrlEncodedApi`, use `FormUrlEncodedConverter` instead
- remove `JsonEncoded` annotation, use `FactoryConverter` instead

## 1.1.0

- ***BreakingChange***
Removed `name` parameter on `ChopperApi`
New way to instanciate a service
Removed `name` parameter on `ChopperApi`
New way to instanciate a service

@ChopperApi()
abstract class MyService extends ChopperService {
static MyService create([ChopperClient client]) => _$MyService(client);
}


## 1.0.0

- Multipart request
Expand Down
10 changes: 10 additions & 0 deletions chopper/lib/src/interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ class CurlInterceptor implements RequestInterceptor {
curl += ' -d \'$body\'';
}
}
if (baseRequest is http.MultipartRequest) {
final fields = baseRequest.fields;
final files = baseRequest.files;
fields.forEach((k, v) {
curl += ' -f \'$k: $v\'';
});
for (var file in files) {
curl += ' -f \'${file.field}: ${file.filename ?? ''}\'';
}
}
curl += ' "$url"';
chopperLogger.info(curl);

Expand Down
1 change: 1 addition & 0 deletions chopper/lib/src/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class Request extends http.BaseRequest with EquatableMixin {
@visibleForTesting
http.Request toHttpRequest() {
final http.Request request = http.Request(method, url)
..followRedirects = followRedirects
..headers.addAll(headers);

if (body != null) {
Expand Down
4 changes: 2 additions & 2 deletions 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: 6.1.2
version: 6.1.3
documentation: https://hadrien-lejard.gitbook.io/chopper
repository: https://github.com/lejard-h/chopper

Expand All @@ -9,7 +9,7 @@ environment:

dependencies:
equatable: ^2.0.5
http: ">=0.13.0 <1.0.0"
http: ">=0.13.0 <2.0.0"
logging: ^1.0.0
meta: ^1.3.0

Expand Down
29 changes: 29 additions & 0 deletions chopper/test/interceptors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,35 @@ void main() {
),
);
});

final fakeRequestMultipart = Request(
'POST',
Uri.parse('/'),
Uri.parse('base'),
headers: {'foo': 'bar'},
parts: [
PartValue<int>('p1', 123),
PartValueFile<http.MultipartFile>(
'p2',
http.MultipartFile.fromBytes('file', [0], filename: 'filename'),
),
],
multipart: true,
);

test('Curl interceptors Multipart', () async {
final curl = CurlInterceptor();
var log = '';
chopperLogger.onRecord.listen((r) => log = r.message);
await curl.onRequest(fakeRequestMultipart);

expect(
log,
equals(
"curl -v -X POST -H 'foo: bar' -f 'p1: 123' -f 'file: filename' \"base/\"",
),
);
});
});
}

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

## 1.2.2

- Update http constraint to ">=0.13.0 <2.0.0" ([#431](https://github.com/lejard-h/chopper/pull/431))

## 1.2.1

- Packages upgrade, constraints upgrade
Expand Down
4 changes: 2 additions & 2 deletions chopper_built_value/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chopper_built_value
description: A built_value based Converter for Chopper.
version: 1.2.1
version: 1.2.2
documentation: https://hadrien-lejard.gitbook.io/chopper/converters/built-value-converter
repository: https://github.com/lejard-h/chopper

Expand All @@ -11,7 +11,7 @@ dependencies:
built_value: ^8.0.0
built_collection: ^5.0.0
chopper: ^6.0.0
http: ^0.13.0
http: ">=0.13.0 <2.0.0"

dev_dependencies:
test: ^1.16.4
Expand Down
49 changes: 26 additions & 23 deletions chopper_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
## 4.0.1

- Fix for the null safety support

## 4.0.0

- **Null safety support**
- Fix `@Header` annotation not generating null safe code
- Respect `required` keyword in functions


## 3.0.5

- Packages upgrade
Expand All @@ -66,7 +66,8 @@

## 3.0.0

- Maintenance release to support last version of `chopper` package (3.0.0) that introduced a breaking change on error handling
- Maintenance release to support last version of `chopper` package (3.0.0) that introduced a breaking change on error
handling

## 2.5.0

Expand All @@ -76,8 +77,8 @@
## 2.4.2

- Fix on JsonConverter
If content type header overrided using @Post(headers: {'content-type': '...'})
The converter won't add json header and won't apply json.encode if content type is not JSON
If content type header overrided using @Post(headers: {'content-type': '...'})
The converter won't add json header and won't apply json.encode if content type is not JSON

- add `bool override` on `applyHeader(s)` functions, true by default

Expand All @@ -94,7 +95,7 @@

## 2.3.4

fix trailing slash when empty path
fix trailing slash when empty path

## 2.3.3

Expand Down Expand Up @@ -127,12 +128,12 @@
## 2.2.0

- Fix converter issue on List
- ***Breaking Change***
on `Converter.convertResponse<ResultType>(response)`,
it take a new generic type => `Converter.convertResponse<ResultType, ItemType>(response)`
- ***Breaking Change***
on `Converter.convertResponse<ResultType>(response)`,
it take a new generic type => `Converter.convertResponse<ResultType, ItemType>(response)`

- deprecated `Chopper.service<Type>(Type)`, use `Chopper.getservice<Type>()` instead
thanks to @MichaelDark
thanks to @MichaelDark

## 2.1.0

Expand All @@ -142,29 +143,31 @@ thanks to @MichaelDark

- Request is now containing baseUrl
- Can call `Request.toHttpRequest()` direclty to get the `http.BaseRequest` will receive
- If a full url is specified in the `path` (ex: @Get(path: 'https://...')), it won't be concaten with the baseUrl of the ChopperClient and the ChopperAPI
- If a full url is specified in the `path` (ex: @Get(path: 'https://...')), it won't be concaten with the baseUrl of the
ChopperClient and the ChopperAPI
- Add `CurlInterceptor` thanks @edwardaux
- Add `HttpLoggingInterceptor`
- Add `FactoryConverter` annotation `@FactoryConverter(request: convertRequest, response: convertResponse)`

- ***BreakingChange***
- Method.url renamed to path
- `Converter.encode` and `Converter.decode` removed, implement `Converter.convertResponse` and Converter.convertRequest` instead
- `ChopperClient.jsonApi` deprecated, use a `JsonConverter` instead
- `ChopperClient.formUrlEncodedApi`, use `FormUrlEncodedConverter` instead
- remove `JsonEncoded` annotation, use `FactoryConverter` instead
- Method.url renamed to path
- `Converter.encode` and `Converter.decode` removed, implement `Converter.convertResponse` and
Converter.convertRequest` instead
- `ChopperClient.jsonApi` deprecated, use a `JsonConverter` instead
- `ChopperClient.formUrlEncodedApi`, use `FormUrlEncodedConverter` instead
- remove `JsonEncoded` annotation, use `FactoryConverter` instead

## 1.1.0

- ***BreakingChange***
Removed `name` parameter on `ChopperApi`
New way to instanciate a service
```dart
@ChopperApi()
abstract class MyService extends ChopperService {
static MyService create([ChopperClient client]) => _$MyService(client);
}
```
Removed `name` parameter on `ChopperApi`
New way to instanciate a service
```dart
@ChopperApi()
abstract class MyService extends ChopperService {
static MyService create([ChopperClient client]) => _$MyService(client);
}
```

## 1.0.1

Expand Down
6 changes: 5 additions & 1 deletion example/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ targets:
any_map: false
checked: false
explicit_to_json: true
create_to_json: true
create_to_json: true
squadron_builder:worker_builder:
options:
with_finalizers: true
serialization_type: List
2 changes: 1 addition & 1 deletion example/lib/json_decode_service.vm.g.dart

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

Loading

0 comments on commit 87fb6c5

Please sign in to comment.