|
1 | 1 | import { HTTPController } from '../../src/decorator/http/HTTPController'; |
2 | 2 | import { Context } from '../../src/decorator/Context'; |
3 | 3 | import { Middleware } from '../../src/decorator/Middleware'; |
4 | | -import { EggContext, HTTPMethodEnum, Next } from '../../src/model'; |
5 | | -import { HTTPBody, HTTPParam, HTTPQueries, HTTPQuery } from '../../src/decorator/http/HTTPParam'; |
| 4 | +import { EggContext, HTTPMethodEnum, Next, IncomingHttpHeaders } from '../../src/model'; |
| 5 | +import { |
| 6 | + HTTPBody, HTTPParam, HTTPQueries, HTTPQuery, HTTPHeaders, |
| 7 | +} from '../../src/decorator/http/HTTPParam'; |
6 | 8 | import { HTTPMethod } from '../../src/decorator/http/HTTPMethod'; |
7 | 9 |
|
8 | 10 | async function middleware1(ctx: EggContext, next: Next) { |
@@ -45,8 +47,9 @@ export class ControllerWithParam { |
45 | 47 | path: '/bar/:id', |
46 | 48 | method: HTTPMethodEnum.GET, |
47 | 49 | }) |
48 | | - async bar(@Context() ctx: EggContext, @HTTPParam() id: string, @HTTPParam() fooId: string) { |
49 | | - console.log(ctx, id, fooId); |
| 50 | + async bar(@Context() ctx: EggContext, @HTTPParam() id: string, @HTTPParam() fooId: string, |
| 51 | + @HTTPHeaders() headers: IncomingHttpHeaders) { |
| 52 | + console.log(ctx, id, fooId, headers); |
50 | 53 | } |
51 | 54 | } |
52 | 55 |
|
|
0 commit comments