- commit
- 549ad2d57175a03e33fa11488bac83b23a73231b
- parent
- f991323323e7175531e9d9e00f90590b2683009e
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-05-05 08:18
fix regression: non-scraping requests
Diffstat
| M | jsonproxy/__init__.py | 10 | +++++++--- |
1 files changed, 7 insertions, 3 deletions
diff --git a/jsonproxy/__init__.py b/jsonproxy/__init__.py
@@ -67,7 +67,7 @@ async def _request(method, url): 67 67 response.raise_for_status() 68 68 # get response before closing the connection 69 69 body = await response.read()70 -1 return body, response.status-1 70 return body, response 71 71 72 72 73 73 async def handle(request): @@ -82,11 +82,15 @@ async def handle(request): 82 82 if request.query_string: 83 83 url += '?' + request.query_string 84 8485 -1 body, status = await _request(request.method, url)-1 85 body, original = await _request(request.method, url) 86 86 87 87 if 'fields' in config: 88 88 data = scrape(url, body, config)89 -1 response = web.json_response(data, status=status)-1 89 response = web.json_response(data, status=original.status) -1 90 else: -1 91 response = web.Response( -1 92 body=body, status=original.status, content_type=original.content_type -1 93 ) 90 94 91 95 if CONFIG.get('ALLOW_CORS', False): 92 96 response.headers['Access-Control-Allow-Origin'] = '*'