Skip to content

Fix for #116 #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.2] - 2021-05-12
### Fixed
- PersistentHandler to implement HttpHandler

## [5.0.1] - 2021-05-11
### Fixed
- Missing http client exports
Expand Down Expand Up @@ -192,6 +196,7 @@ the Document model.
### Added
- Client: fetch resources, collections, related resources and relationships

[5.0.2]: https://github.com/f3ath/json-api-dart/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/f3ath/json-api-dart/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/f3ath/json-api-dart/compare/3.2.3...5.0.0
[3.2.3]: https://github.com/f3ath/json-api-dart/compare/3.2.2...3.2.3
Expand Down
3 changes: 2 additions & 1 deletion lib/src/client/persistent_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import 'package:json_api/http.dart';
/// Handler which relies on the built-in Dart HTTP client.
/// It is the developer's responsibility to instantiate the client and
/// call `close()` on it in the end pf the application lifecycle.
class PersistentHandler {
class PersistentHandler implements HttpHandler {
/// Creates a new instance of the handler. Do not forget to call `close()` on
/// the [client] when it's not longer needed.
PersistentHandler(this.client, {this.defaultEncoding = utf8});

final Client client;
final Encoding defaultEncoding;

@override
Future<HttpResponse> handle(HttpRequest request) async {
final response = await Response.fromStream(
await client.send(Request(request.method, request.uri)
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_api
version: 5.0.1
version: 5.0.2
homepage: https://github.com/f3ath/json-api-dart
description: A framework-agnostic implementations of JSON:API Client and Server. Supports JSON:API v1.0 (https://jsonapi.org)
environment:
Expand Down