0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore(core): update custom phrase PUT API response status (#3830)

This commit is contained in:
Darcy Ye 2023-05-13 00:23:00 +08:00 committed by GitHub
parent 59a6ad3b7d
commit 7598ddefd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -154,7 +154,7 @@ describe('customPhraseRoutes', () => {
const response = await customPhraseRequest
.put(`/custom-phrases/${mockLanguageTag}`)
.send(translation);
expect(response.status).toEqual(200);
expect(response.status).toEqual(201);
expect(response.body).toEqual(mockCustomPhrases[mockLanguageTag]);
});

View file

@ -67,7 +67,7 @@ export default function customPhraseRoutes<T extends AuthedRouter>(
params: object({ languageTag: languageTagGuard }),
body: translationGuard,
response: CustomPhrases.guard,
status: [200, 422],
status: [201, 422],
}),
async (ctx, next) => {
const {
@ -83,6 +83,7 @@ export default function customPhraseRoutes<T extends AuthedRouter>(
);
ctx.body = await upsertCustomPhrase(languageTag, translation);
ctx.status = 201;
return next();
}