Skip to content

Commit 3f54d06

Browse files
committed
Fix doc for sync metadata interceptor (connectrpc#35)
Signed-off-by: Anuraag Agrawal <[email protected]>
1 parent 3a1865e commit 3f54d06

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/interceptors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ An authentication interceptor checking bearer tokens and storing them to a conte
212212
def __init__(self, valid_tokens: list[str]):
213213
self._valid_tokens = valid_tokens
214214

215-
def on_start(self, ctx: RequestContext) -> Token["auth_token"]:
215+
def on_start_sync(self, ctx: RequestContext) -> Token["auth_token"]:
216216
authorization = ctx.request_headers().get("authorization")
217217
if not authorization or not authorization.startswith("Bearer "):
218218
raise ConnectError(Code.UNAUTHENTICATED)
@@ -221,7 +221,7 @@ An authentication interceptor checking bearer tokens and storing them to a conte
221221
raise ConnectError(Code.PERMISSION_DENIED)
222222
return _auth_token.set(token)
223223

224-
def on_end(self, token: Token["auth_token"], ctx: RequestContext):
224+
def on_end_sync(self, token: Token["auth_token"], ctx: RequestContext):
225225
_auth_token.reset(token)
226226
```
227227

@@ -253,7 +253,7 @@ the authorization header.
253253
_auth_token = ContextVar["auth_token"]("current_auth_token")
254254

255255
class ClientAuthInterceptor:
256-
def on_start(self, ctx: RequestContext):
256+
def on_start_sync(self, ctx: RequestContext):
257257
auth_token = _auth_token.get(None)
258258
if auth_token:
259259
ctx.request_headers()["authorization"] = f"Bearer {auth_token}"

0 commit comments

Comments
 (0)