Skip to content

Commit c37dbb9

Browse files
committed
Revert "Fix GraphQL integration swallowing responses (#2286)"
This reverts commit e918504.
1 parent 854d572 commit c37dbb9

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

sentry_sdk/integrations/stdlib.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ def getresponse(self, *args, **kwargs):
185185
response_data = rv.read()
186186
# once we've read() the body it can't be read() again by the
187187
# app; save it so that it can be accessed again
188-
saved_response = io.BytesIO(response_data)
189-
rv.read = saved_response.read
190-
rv.fp = saved_response
188+
rv.read = io.BytesIO(response_data).read
191189
try:
192190
# py3.6+ json.loads() can deal with bytes out of the box, but
193191
# for older version we have to explicitly decode first

tests/integrations/requests/test_requests.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import pytest
32
import responses
43

@@ -8,15 +7,11 @@
87
from sentry_sdk.consts import SPANDATA
98
from sentry_sdk.integrations.stdlib import StdlibIntegration
109

11-
from tests.conftest import MockServerRequestHandler, create_mock_http_server
12-
1310
try:
1411
from unittest import mock # python 3.3 and above
1512
except ImportError:
1613
import mock # python < 3.3
1714

18-
PORT = create_mock_http_server()
19-
2015

2116
def test_crumb_capture(sentry_init, capture_events):
2217
sentry_init(integrations=[StdlibIntegration()])
@@ -67,22 +62,3 @@ def test_omit_url_data_if_parsing_fails(sentry_init, capture_events):
6762
"reason": response.reason,
6863
# no url related data
6964
}
70-
71-
72-
def test_graphql_integration_doesnt_affect_responses(sentry_init, capture_events):
73-
sentry_init(integrations=[StdlibIntegration()])
74-
75-
events = capture_events()
76-
77-
msg = {"errors": [{"message": "some message"}]}
78-
79-
def do_POST(self): # noqa: N802
80-
self.send_response(200)
81-
self.end_headers()
82-
self.wfile.write(json.dumps(msg).encode())
83-
84-
with mock.patch.object(MockServerRequestHandler, "do_POST", do_POST):
85-
response = requests.post("http://localhost:{}".format(PORT) + "/graphql")
86-
87-
assert len(events) == 1
88-
assert response.json() == msg

0 commit comments

Comments
 (0)