-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
![image](https://github.com/cnpm/cnpmcore/assets/5574625/d158e354-d390-4835-91de-7aa9f5104e49) > close #551 , 针对未实现的 post 请求添加错误码 1. 🧶 拦截 audit 相关接口 [ref](https://docs.npmjs.com/cli/v9/commands/npm-audit) 2. ♻️ 默认 404 GET 接口不做额外处理 ----- > close #551, add error code for unimplemented post requests 1. 🧶 Intercept audit-related interfaces [ref](https://docs.npmjs.com/cli/v9/commands/npm-audit) 2. ♻️ No additional processing for default 404 GET interfaces.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { app, assert } from 'egg-mock/bootstrap'; | ||
|
||
describe('test/port/controller/HomeController/misc.test.ts', () => { | ||
describe('[POST /*] misc()', () => { | ||
it('should 501', async () => { | ||
const res = await app.httpRequest() | ||
.post('/-/npm/v1/security/audits/quick') | ||
.expect(501); | ||
assert.equal(res.body.error, '[NOT_IMPLEMENTED] /-/npm/v1/security/audits/quick not implemented yet'); | ||
}); | ||
|
||
it('should 404', async () => { | ||
const res = await app.httpRequest() | ||
.post('/-/greed/is/good') | ||
.expect(404); | ||
assert.equal(res.body.error, '[NOT_FOUND] /-/greed/is/good not found'); | ||
}); | ||
}); | ||
|
||
}); |