JS: model Koa redirects

This commit is contained in:
Esben Sparre Andreasen
2019-03-21 15:03:51 +01:00
parent 298dbe13c4
commit 00c8387bb3
4 changed files with 69 additions and 0 deletions

View File

@@ -291,4 +291,20 @@ module Koa {
override RouteHandler getRouteHandler() { result = rh }
}
/**
* An invocation of the `redirect` method of an HTTP response object.
*/
private class RedirectInvocation extends HTTP::RedirectInvocation, MethodCallExpr {
RouteHandler rh;
RedirectInvocation() {
this.(MethodCallExpr).calls(rh.getAResponseOrContextExpr(), "redirect")
}
override Expr getUrlArgument() { result = getArgument(0) }
override RouteHandler getRouteHandler() { result = rh }
}
}