[breaks api] Proxy no longer takes app as first parameter
We can use the app reference contained in RequestContext
This commit is contained in:
parent
7c702012c1
commit
21a3f43103
4 changed files with 1 additions and 8 deletions
|
@ -14,7 +14,6 @@ main() async {
|
|||
// Forward any /api requests to pub.
|
||||
// By default, if the host throws a 404, the request will fall through to the next handler.
|
||||
var pubProxy = new Proxy(
|
||||
app,
|
||||
client,
|
||||
'https://pub.dartlang.org',
|
||||
publicPath: '/pub',
|
||||
|
@ -30,7 +29,6 @@ main() async {
|
|||
|
||||
// Anything else should fall through to dartlang.org.
|
||||
var dartlangProxy = new Proxy(
|
||||
app,
|
||||
client,
|
||||
'https://dartlang.org',
|
||||
timeout: timeout,
|
||||
|
|
|
@ -11,7 +11,6 @@ final MediaType _fallbackMediaType = MediaType('application', 'octet-stream');
|
|||
class Proxy {
|
||||
String _prefix;
|
||||
|
||||
final Angel app;
|
||||
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.
|
||||
|
@ -25,7 +24,6 @@ class Proxy {
|
|||
final Duration timeout;
|
||||
|
||||
Proxy(
|
||||
this.app,
|
||||
this.httpClient,
|
||||
this.host, {
|
||||
this.port,
|
||||
|
@ -88,7 +86,7 @@ class Proxy {
|
|||
|
||||
var body;
|
||||
|
||||
if (req.method != 'GET' && app.keepRawRequestBuffers == true) {
|
||||
if (req.method != 'GET' && req.app.keepRawRequestBuffers == true) {
|
||||
body = (await req.parse()).originalBuffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,12 @@ main() {
|
|||
testServer = await startTestServer();
|
||||
|
||||
var proxy1 = new Proxy(
|
||||
app,
|
||||
httpClient,
|
||||
testServer.address.address,
|
||||
port: testServer.port,
|
||||
publicPath: '/proxy',
|
||||
);
|
||||
var proxy2 = new Proxy(
|
||||
app,
|
||||
httpClient,
|
||||
testServer.address.address,
|
||||
port: testServer.port,
|
||||
|
|
|
@ -34,7 +34,6 @@ main() {
|
|||
var httpClient = new http.Client();
|
||||
|
||||
layer = new Proxy(
|
||||
app,
|
||||
httpClient,
|
||||
server.address.address,
|
||||
port: server.port,
|
||||
|
|
Loading…
Reference in a new issue