diff --git a/app/port/webauth/WebauthController.ts b/app/port/webauth/WebauthController.ts index d4939c7d..4f57db6a 100644 --- a/app/port/webauth/WebauthController.ts +++ b/app/port/webauth/WebauthController.ts @@ -35,8 +35,8 @@ import { genRSAKeys, decryptRSA } from '../../common/CryptoUtil'; import { getBrowserTypeForWebauthn } from '../../common/UserUtil'; const LoginRequestRule = Type.Object({ - // cli 所在机器的 hostname - hostname: Type.String({ minLength: 1, maxLength: 100 }), + // cli 所在机器的 hostname,最新版本 npm cli 已经不会上报 hostname + hostname: Type.Optional(Type.String({ minLength: 1, maxLength: 100 })), }); type LoginRequest = Static; diff --git a/test/port/webauth/webauthController.test.ts b/test/port/webauth/webauthController.test.ts index aef0720c..787cc0f9 100644 --- a/test/port/webauth/webauthController.test.ts +++ b/test/port/webauth/webauthController.test.ts @@ -26,12 +26,11 @@ describe('test/port/webauth/webauthController.test.ts', () => { assert.equal(loginSessionId.length, 36); }); - it('should check hostname', async () => { + it('should hostname is optional', async () => { const res = await app.httpRequest() .post('/-/v1/login'); - assert.equal(res.status, 422); - assert.equal(res.body.error, "[INVALID_PARAM] must have required property 'hostname'"); + assert.equal(res.status, 200); }); });