[breaks api] Proxy no longer takes app as first parameter

We can use the app reference contained in RequestContext
This commit is contained in:
denkuy 2018-11-02 12:20:00 +01:00
parent 7c702012c1
commit 21a3f43103
4 changed files with 1 additions and 8 deletions

View file

@ -14,7 +14,6 @@ main() async {
// Forward any /api requests to pub. // Forward any /api requests to pub.
// By default, if the host throws a 404, the request will fall through to the next handler. // By default, if the host throws a 404, the request will fall through to the next handler.
var pubProxy = new Proxy( var pubProxy = new Proxy(
app,
client, client,
'https://pub.dartlang.org', 'https://pub.dartlang.org',
publicPath: '/pub', publicPath: '/pub',
@ -30,7 +29,6 @@ main() async {
// Anything else should fall through to dartlang.org. // Anything else should fall through to dartlang.org.
var dartlangProxy = new Proxy( var dartlangProxy = new Proxy(
app,
client, client,
'https://dartlang.org', 'https://dartlang.org',
timeout: timeout, timeout: timeout,

View file

@ -11,7 +11,6 @@ final MediaType _fallbackMediaType = MediaType('application', 'octet-stream');
class Proxy { class Proxy {
String _prefix; String _prefix;
final Angel app;
final http.Client httpClient; final http.Client httpClient;
/// If `true` (default), then the plug-in will ignore failures to connect to the proxy, and allow other handlers to run. /// If `true` (default), then the plug-in will ignore failures to connect to the proxy, and allow other handlers to run.
@ -25,7 +24,6 @@ class Proxy {
final Duration timeout; final Duration timeout;
Proxy( Proxy(
this.app,
this.httpClient, this.httpClient,
this.host, { this.host, {
this.port, this.port,
@ -88,7 +86,7 @@ class Proxy {
var body; var body;
if (req.method != 'GET' && app.keepRawRequestBuffers == true) { if (req.method != 'GET' && req.app.keepRawRequestBuffers == true) {
body = (await req.parse()).originalBuffer; body = (await req.parse()).originalBuffer;
} }

View file

@ -22,14 +22,12 @@ main() {
testServer = await startTestServer(); testServer = await startTestServer();
var proxy1 = new Proxy( var proxy1 = new Proxy(
app,
httpClient, httpClient,
testServer.address.address, testServer.address.address,
port: testServer.port, port: testServer.port,
publicPath: '/proxy', publicPath: '/proxy',
); );
var proxy2 = new Proxy( var proxy2 = new Proxy(
app,
httpClient, httpClient,
testServer.address.address, testServer.address.address,
port: testServer.port, port: testServer.port,

View file

@ -34,7 +34,6 @@ main() {
var httpClient = new http.Client(); var httpClient = new http.Client();
layer = new Proxy( layer = new Proxy(
app,
httpClient, httpClient,
server.address.address, server.address.address,
port: server.port, port: server.port,