Skip to content

Commit

Permalink
fix typo and add explicit future checking!
Browse files Browse the repository at this point in the history
  • Loading branch information
samandmoore committed Apr 13, 2023
1 parent a101891 commit a42724a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ responses from your [Dio HTTP Client](https://pub.dev/packages/dio).
This makes it easy to test the behavior of code that interacts with
HTTP services without having to use mocks.

It consists of a two components and a few helper functions:
It consists of two components and a few helper functions:

- `Charlatan` - a class for configuring and providing fake HTTP responses
based on HTTP method and URI template.
Expand Down
6 changes: 5 additions & 1 deletion lib/src/charlatan_response_definition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ class CharlatanResponseDefinition {
Future<CharlatanHttpResponse> buildResponse(
CharlatanHttpRequest request,
) async {
return responseBuilder(request);
final responseOrFuture = responseBuilder(request);
if (responseOrFuture is Future<CharlatanHttpResponse>) {
return await responseOrFuture;
}
return responseOrFuture;
}
}

Expand Down

0 comments on commit a42724a

Please sign in to comment.