-
Notifications
You must be signed in to change notification settings - Fork 247
More details in snapshot fetch errors #7638
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?
Changes from all commits
7a4cce8
1b4c3e2
4e373cb
e719c1f
8a6ccb7
c4c8ce7
004e4b9
655a119
3d7e23c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,17 +18,21 @@ | |||||||||||||||||||||||||
| #include <string> | ||||||||||||||||||||||||||
| #include <vector> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #define EXPECT_HTTP_RESPONSE_STATUS(request, status_code, expected) \ | ||||||||||||||||||||||||||
| #define EXPECT_HTTP_RESPONSE_STATUS( \ | ||||||||||||||||||||||||||
| request, status_code, expected, response_body) \ | ||||||||||||||||||||||||||
| do \ | ||||||||||||||||||||||||||
| { \ | ||||||||||||||||||||||||||
| if (status_code != expected) \ | ||||||||||||||||||||||||||
| { \ | ||||||||||||||||||||||||||
| std::string response_content( \ | ||||||||||||||||||||||||||
| response_body->buffer.begin(), response_body->buffer.end()); \ | ||||||||||||||||||||||||||
|
Comment on lines
+27
to
+28
|
||||||||||||||||||||||||||
| std::string response_content( \ | |
| response_body->buffer.begin(), response_body->buffer.end()); \ | |
| std::string response_content; \ | |
| if (response_body != nullptr) \ | |
| { \ | |
| response_content.assign( \ | |
| response_body->buffer.begin(), response_body->buffer.end()); \ | |
| } \ | |
| else \ | |
| { \ | |
| response_content = "(no response body)"; \ | |
| } \ |
Copilot
AI
Feb 5, 2026
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.
Constructing a string from the entire response buffer could be problematic for large responses or binary data. Since snapshots can be "extremely large" (as noted in the comment at lines 198-199), this could cause memory issues or create an unwieldy error message. Consider either: (1) truncating the response content to a reasonable size (e.g., first 500 bytes), or (2) only including the response body for specific error codes that are expected to have small, informative responses (like 400 Bad Request).
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.
If the response buffer contains binary data or non-UTF8 content, constructing a string directly from the buffer could result in invalid UTF-8 sequences or unprintable characters in the error message. Consider sanitizing the content for display, for example by using a hex dump for binary data or escaping non-printable characters.