Skip to content
Merged
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
10 changes: 5 additions & 5 deletions bsv/auth/transports/simplified_http_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def send(self, ctx: Any, message: AuthMessage) -> Optional[Exception]:
return Exception("No handler registered")
try:
if getattr(message, 'message_type', None) == 'general':
# payloadをHTTPリクエストとしてデシリアライズ(簡易実装)
# ここではpayloadはJSONでリクエスト情報が入っていると仮定
# Deserialize the payload into HTTP request parameters (simplified implementation)
# Here we assume the payload is JSON containing the request information
import json
try:
req_info = json.loads(message.payload.decode('utf-8'))
Expand All @@ -35,7 +35,7 @@ def send(self, ctx: Any, message: AuthMessage) -> Optional[Exception]:
body = req_info.get('body', None)
url = self.base_url + path
resp = self.client.request(method, url, headers=headers, data=body)
# レスポンスをAuthMessageでラップしてコールバック
# Wrap the response in an AuthMessage and trigger callbacks
resp_payload = {
'status_code': resp.status_code,
'headers': dict(resp.headers),
Expand All @@ -48,7 +48,7 @@ def send(self, ctx: Any, message: AuthMessage) -> Optional[Exception]:
)
self._notify_handlers(ctx, response_msg)
return None
# 通常のAuthMessage送信
# Send a standard AuthMessage
url = self.base_url
if getattr(message, 'message_type', None) != 'general':
url = self.base_url.rstrip('/') + '/.well-known/auth'
Expand All @@ -63,7 +63,7 @@ def send(self, ctx: Any, message: AuthMessage) -> Optional[Exception]:
response_msg = AuthMessage(**resp_data)
self._notify_handlers(ctx, response_msg)
except Exception:
pass # 応答がAuthMessageでなければ無視
pass # Ignore the response if it is not an AuthMessage
return None
except Exception as e:
return Exception(f"Failed to send AuthMessage: {e}")
Expand Down