summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2017-03-02 21:47:22 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2017-03-02 21:47:22 +0100
commitb0c882fd825d3e38faf7e622543a566ebb046873 (patch)
treefacad3558035bbf7fab34df07b96a6f88a4274f1
parent7c5b42710153622a7a774a3e85c7d002f1c8075f (diff)
downloadraven-feature/no-flask-darra.tar.gz
No longer provide form data for Flask. Fixes #457feature/no-flask-darra
-rw-r--r--CHANGES5
-rw-r--r--raven/contrib/flask.py29
-rw-r--r--tests/contrib/flask/tests.py3
3 files changed, 5 insertions, 32 deletions
diff --git a/CHANGES b/CHANGES
index 6d73330..1b9c8f5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+Version 6.1.0
+-------------
+
+* No longer provide form data for Flask (#457)
+
Version 6.0.0
-------------
diff --git a/raven/contrib/flask.py b/raven/contrib/flask.py
index a13b838..e88ddb4 100644
--- a/raven/contrib/flask.py
+++ b/raven/contrib/flask.py
@@ -19,7 +19,6 @@ import logging
from flask import request, current_app, g
from flask.signals import got_request_exception, request_finished
-from werkzeug.exceptions import ClientDisconnected
from raven.conf import setup_logging
from raven.base import Client
@@ -176,40 +175,12 @@ class Sentry(object):
"""
Determine how to retrieve actual data by using request.mimetype.
"""
- if self.is_json_type(request.mimetype):
- retriever = self.get_json_data
- else:
- retriever = self.get_form_data
- return self.get_http_info_with_retriever(request, retriever)
-
- def is_json_type(self, content_type):
- return content_type == 'application/json'
-
- def get_form_data(self, request):
- return request.form
-
- def get_json_data(self, request):
- return request.data
-
- def get_http_info_with_retriever(self, request, retriever=None):
- """
- Exact method for getting http_info but with form data work around.
- """
- if retriever is None:
- retriever = self.get_form_data
-
urlparts = urlparse.urlsplit(request.url)
- try:
- data = retriever(request)
- except ClientDisconnected:
- data = {}
-
return {
'url': '%s://%s%s' % (urlparts.scheme, urlparts.netloc, urlparts.path),
'query_string': urlparts.query,
'method': request.method,
- 'data': data,
'headers': dict(get_headers(request.environ)),
'env': dict(get_environ(request.environ)),
}
diff --git a/tests/contrib/flask/tests.py b/tests/contrib/flask/tests.py
index 4fffc53..9187307 100644
--- a/tests/contrib/flask/tests.py
+++ b/tests/contrib/flask/tests.py
@@ -130,7 +130,6 @@ class FlaskTest(BaseTest):
self.assertEquals(http['url'], 'http://localhost/an-error/')
self.assertEquals(http['query_string'], 'foo=bar')
self.assertEquals(http['method'], 'GET')
- self.assertEquals(http['data'], {})
self.assertTrue('headers' in http)
headers = http['headers']
self.assertTrue('Content-Length' in headers, headers.keys())
@@ -157,7 +156,6 @@ class FlaskTest(BaseTest):
self.assertEquals(http['url'], 'http://localhost/an-error/')
self.assertEquals(http['query_string'], 'biz=baz')
self.assertEquals(http['method'], 'POST')
- self.assertEquals(http['data'], {'foo': 'bar'})
self.assertTrue('headers' in http)
headers = http['headers']
self.assertTrue('Content-Length' in headers, headers.keys())
@@ -205,7 +203,6 @@ class FlaskTest(BaseTest):
assert 'request' in event
http = event['request']
- self.assertEqual({}, http.get('data'))
def test_wrap_wsgi_status(self):
_, _, app_debug = self.make_client_and_raven(debug=True)