-
Notifications
You must be signed in to change notification settings - Fork 9
Add opt-in verbose mode for capturing HTTP response metadata #718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an opt-in verbose mode to capture HTTP response metadata (headers, status codes, etc.) for debugging failed requests with Descope support. The implementation introduces a DescopeResponse wrapper class that maintains backward compatibility while exposing HTTP metadata, and adds verbose parameters to both DescopeClient and HTTPClient that default to False.
Key Changes:
- New
DescopeResponsewrapper providing dict-like interface plus HTTP metadata access - Opt-in
verboseparameter added to client constructors (defaults toFalse) - Response capture logic in HTTP methods when verbose mode is enabled
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
descope/http_client.py |
Core implementation with DescopeResponse class and verbose mode capture logic |
descope/descope_client.py |
Added verbose parameter forwarding and get_last_response() method |
descope/__init__.py |
Exported DescopeResponse for public API access |
tests/test_http_client.py |
Unit tests for DescopeResponse wrapper and HTTPClient verbose mode |
tests/test_descope_client.py |
Integration tests for DescopeClient verbose mode functionality |
samples/verbose_mode_example.py |
Example demonstrating verbose mode usage for debugging |
README.md |
Documentation for verbose mode feature and usage examples |
.pre-commit-config.yaml |
Updated pre-commit hook versions and reorganized poetry-export hook |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add verbose mode to DescopeClient and HTTPClient to capture HTTP response metadata (headers, status codes, etc.) for debugging failed requests. Key changes: - Add DescopeResponse wrapper class providing dict-like interface while exposing HTTP metadata (headers, status_code, text, etc.) - Add verbose parameter to DescopeClient and HTTPClient (defaults to False) - Add get_last_response() methods to access captured response data - Maintain full backward compatibility (zero overhead when disabled) - Add comprehensive tests (366 total tests passing) - Add usage examples and documentation This enables customers to capture cf-ray headers and other HTTP metadata when troubleshooting issues with Descope support. Fixes descope/etc#12957
cddbdfe to
81060f7
Compare
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)descope/http_client.py
descope/descope_client.py
descope/init.py
|
@omercnet check the coverage issue |
…esponse - Fix: Move verbose capture before error raising so failed responses are captured - Add: Tests for all DescopeResponse dict-like methods and properties - Add: Tests for verbose mode capturing GET, POST, PATCH, DELETE responses - Add: Tests for error handling paths (AuthException, RateLimitException) - Add: Tests for header parsing and retry-after edge cases - Coverage: Achieves 98% overall, 100% for http_client.py
Fixed |
|
Looks good to me. |
Summary
Add verbose mode to DescopeClient and HTTPClient to capture HTTP response metadata (headers, status codes, etc.) for debugging failed requests with Descope support.
Key Changes
Use Case
This enables customers to capture cf-ray headers and other HTTP metadata when troubleshooting issues with Descope support:
Testing
Files Changed
descope/http_client.py- Core implementation (DescopeResponse class, verbose mode)descope/descope_client.py- Client-level verbose mode supportdescope/__init__.py- Export DescopeResponsetests/test_http_client.py- Unit tests for DescopeResponse and HTTPClient verbose modetests/test_descope_client.py- Integration tests for DescopeClient verbose modesamples/verbose_mode_example.py- Usage examples (new file)README.md- Documentation added.pre-commit-config.yaml- Updated to use official poetry-plugin-export hookFixes https://github.com/descope/etc/issues/12957