Skip to content

Allow for additional, or alternative, options for proxy request #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion nbserverproxy/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ async def proxy(self, port, proxied_path):

req = httpclient.HTTPRequest(
client_uri, method=self.request.method, body=body,
headers=self.request.headers, follow_redirects=False)
headers=self.request.headers,
**self.proxy_request_options())

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

def proxy_request_options(self):
'''A dictionary of options to be used when constructing
a tornado.httpclient.HTTPRequest instance for the proxy request.'''
return dict(follow_redirects=False)

# Support all the methods that torando does by default except for GET which
# is passed to WebSocketHandlerMixin and then to WebSocketHandler.

Expand Down