Skip to content

Commit

Permalink
Make HTTP client public in auto client generation
Browse files Browse the repository at this point in the history
  • Loading branch information
walsha2 committed Aug 27, 2023
1 parent 7cddacf commit 9c6db3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.4.12

* Make HTTP client public in auto client generation

## 0.4.11

* Keep all caps class names in schema generation
Expand Down
10 changes: 5 additions & 5 deletions lib/src/generators/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ class $clientName {
http.Client? client,
}) {
// Create a retry client
_client = RetryClient(client ?? http.Client());
this.client = RetryClient(client ?? http.Client());
}
/// User provided override for host URL
late final String? host;
/// Internal HTTP client
late final http.Client _client;
/// HTTP client for requests
late final http.Client client;
${authVariables.isEmpty ? '' : '/// Authentication related variables'}
${authVariables.join('\n')}
Expand All @@ -192,7 +192,7 @@ class $clientName {
// ------------------------------------------
/// Close the HTTP client and end session
void endSession() => _client.close();
void endSession() => client.close();
// ------------------------------------------
// METHOD: onRequest
Expand Down Expand Up @@ -319,7 +319,7 @@ class $clientName {
request = await onRequest(request);
// Submit request
response = await http.Response.fromStream(await _client.send(request));
response = await http.Response.fromStream(await client.send(request));
// Handle user response middleware
response = await onResponse(response);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: openapi_spec
description: OpenAPI Specification generator using native Dart code, as well as an all-in-one parser of existing specifications.
version: 0.4.11
version: 0.4.12
maintainer: Taza Technology LLC
repository: https://github.com/tazatechnology/openapi_spec
issue_tracker: https://github.com/tazatechnology/openapi_spec/issues
Expand Down

0 comments on commit 9c6db3a

Please sign in to comment.