simple look

This commit is contained in:
Para Dox
2025-04-27 23:18:07 +07:00
parent 7c28a5d536
commit 0a6c5e9fb5

View File

@@ -68,7 +68,7 @@ def proxy():
request_log = f"==> Request:\n{json.dumps(log_incoming, indent=2)}" request_log = f"==> Request:\n{json.dumps(log_incoming, indent=2)}"
# Send the original 'incoming' data to the target # Send the original 'incoming' data to the target
response = requests.post(TARGET_URL_HTTP, json=incoming) response = requests.post(TARGET_URL_HTTP, json=incoming)
outgoing = response.json() outgoing = response.json()
log_lines = [request_log] log_lines = [request_log]
@@ -79,6 +79,13 @@ def proxy():
# Track the method name if an error occurred and method exists in request # Track the method name if an error occurred and method exists in request
if isinstance(incoming, dict) and 'method' in incoming: if isinstance(incoming, dict) and 'method' in incoming:
error_methods.add(incoming['method']) error_methods.add(incoming['method'])
else:
# Log only the method name for successful responses
method_name = "unknown_method" # Default if not found
if isinstance(incoming, dict) and 'method' in incoming:
method_name = incoming['method']
response_log = f"<== Response (Success): Method '{method_name}' completed."
log_lines.append(response_log)
print('\n---\n'.join(log_lines), file=sys.stdout, flush=True) print('\n---\n'.join(log_lines), file=sys.stdout, flush=True)