-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW: support callback protocols in the binder ✨
- Loading branch information
Showing
5 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# Binding | ||
|
||
In order to derive a service implementation, Combadge inspects a provided protocol and extract its methods and the method's signatures. The latter are used to derive request and response models. | ||
In order to derive a service implementation, Combadge inspects the provided protocol and extract its methods and the method's signatures. The latter are used to derive request and response models. | ||
|
||
Result of binding is a service class which encapsulates request and response handling. | ||
Result of the binding is a service class which encapsulates request and response handling. | ||
|
||
## Which methods are inspected? | ||
|
||
- Non-private instance methods – methods which names do not start with `_` and accept `self` as a parameter. | ||
- [`__call__`][1] which allows calling a bound client directly. This may be useful when the protocol is meant to represent a single method and would otherwise just result in the name duplication. | ||
|
||
[1]: https://docs.python.org/3/reference/datamodel.html#object.__call__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/integration/cassettes/test_httpbin/test_callback_protocol.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
interactions: | ||
- request: | ||
body: '' | ||
headers: | ||
accept: | ||
- '*/*' | ||
accept-encoding: | ||
- gzip, deflate | ||
connection: | ||
- keep-alive | ||
host: | ||
- httpbin.org | ||
user-agent: | ||
- python-httpx/0.27.2 | ||
method: GET | ||
uri: https://httpbin.org/user-agent | ||
response: | ||
body: | ||
string: "{\n \"user-agent\": \"python-httpx/0.27.2\"\n}\n" | ||
headers: | ||
Access-Control-Allow-Credentials: | ||
- 'true' | ||
Access-Control-Allow-Origin: | ||
- '*' | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '42' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Wed, 13 Nov 2024 15:33:20 GMT | ||
Server: | ||
- gunicorn/19.9.0 | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters