mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 22:14:46 +00:00
Harden protection with pinned requests and path-param encoding (#2486)
* Harden protection with pinned requests and path-param encoding * fix: domain pinning * fix: tests * fix: html test 2 --------- Co-authored-by: Alex <a@tushynski.me>
This commit is contained in:
1 parent
6cfdc4fbae
commit
aaad51f951
20 files changed
+623
-723
No files matched your search
@@ -581,11 +581,13 @@ class TestReadWebpageErrors:
|
||||
from application.agents.tools.read_webpage import ReadWebpageTool
|
||||
|
||||
tool = ReadWebpageTool({})
|
||||
with patch("application.agents.tools.read_webpage.requests.get") as mock_get:
|
||||
with patch(
|
||||
"application.agents.tools.read_webpage.pinned_request"
|
||||
) as mock_pinned_request:
|
||||
mock_response = MagicMock()
|
||||
mock_response.raise_for_status.return_value = None
|
||||
mock_response.text = "<html><body>test</body></html>"
|
||||
mock_get.return_value = mock_response
|
||||
mock_pinned_request.return_value = mock_response
|
||||
with patch(
|
||||
"application.agents.tools.read_webpage.markdownify",
|
||||
side_effect=Exception("parse error"),
|
||||
|
||||
Reference in new issue
Block a user