Skip to content

Commit f020e78

Browse files
authored
Merge pull request #56 from nokome/master
Allow for additional, or alternative, options for proxy request
2 parents 41d0fae + 3896a3d commit f020e78

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

nbserverproxy/handlers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ async def proxy(self, port, proxied_path):
235235

236236
req = httpclient.HTTPRequest(
237237
client_uri, method=self.request.method, body=body,
238-
headers=self.request.headers, follow_redirects=False)
238+
headers=self.request.headers,
239+
**self.proxy_request_options())
239240

240241
response = await client.fetch(req, raise_error=False)
241242
# record activity at start and end of requests
@@ -260,6 +261,11 @@ async def proxy(self, port, proxied_path):
260261
if response.body:
261262
self.write(response.body)
262263

264+
def proxy_request_options(self):
265+
'''A dictionary of options to be used when constructing
266+
a tornado.httpclient.HTTPRequest instance for the proxy request.'''
267+
return dict(follow_redirects=False)
268+
263269
# Support all the methods that torando does by default except for GET which
264270
# is passed to WebSocketHandlerMixin and then to WebSocketHandler.
265271

0 commit comments

Comments
 (0)