Skip to content

Commit

Permalink
feat: change decorator name
Browse files Browse the repository at this point in the history
  • Loading branch information
412799755 committed Oct 26, 2023
1 parent 487bd87 commit 030cdf0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/controller-decorator/src/decorator/http/HTTPParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function HTTPParam(param?: HTTPParamParams) {
};
}

export function InjectHTTPRequest() {
export function Request() {
return function(target: any, propertyKey: PropertyKey, parameterIndex: number) {
assert(typeof propertyKey === 'string',
`[controller/${target.name}] expect method name be typeof string, but now is ${String(propertyKey)}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
HTTPMethodEnum,
HTTPParam,
HTTPQuery,
InjectHTTPRequest,
Request,
Middleware,
Inject,
HTTPRequest,
Expand Down Expand Up @@ -54,7 +54,7 @@ export class AppController {
method: HTTPMethodEnum.POST,
path: '',
})
async save(@Context() ctx: EggContext, @HTTPBody() app: App, @InjectHTTPRequest() request: HTTPRequest) {
async save(@Context() ctx: EggContext, @HTTPBody() app: App, @Request() request: HTTPRequest) {
const traceId = await ctx.tracer.traceId;
async function streamToString(stream) {
const decoder = new TextDecoder();
Expand Down
2 changes: 1 addition & 1 deletion plugin/controller/test/http/params.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('test/params.test.ts', () => {
});
});

it('InjectHTTPRequest should work', async () => {
it('Request should work', async () => {
app.mockCsrf();
const param = {
name: 'foo',
Expand Down

0 comments on commit 030cdf0

Please sign in to comment.