diff --git a/packages/webui/src/template-http.mjs b/packages/webui/src/template-http.mjs index d0cca1232..591b3fc70 100644 --- a/packages/webui/src/template-http.mjs +++ b/packages/webui/src/template-http.mjs @@ -28,7 +28,7 @@ const LIMIT = 4096; const codes = { 'invalid-request': 400, 'template-secret-suspected': 400, 'starter-pack-invalid': 400, 'project-not-found': 404, - 'pack-plan-stale': 409, 'starter-pack-template-changed': 409, 'organization-busy': 409, + 'pack-plan-stale': 409, 'starter-pack-template-changed': 409, 'organization-busy': 409, 'template-exists': 409, 'human-required': 403, 'read-only': 403, 'not-configured': 503, 'no-bus-host': 503, }; diff --git a/packages/webui/tests/template-http.test.mjs b/packages/webui/tests/template-http.test.mjs index f67a1a7bb..2ed0fa693 100644 --- a/packages/webui/tests/template-http.test.mjs +++ b/packages/webui/tests/template-http.test.mjs @@ -85,7 +85,7 @@ test('SP8 the owner previews a template (nothing written), saves it with the dig assert.equal(readFileSync(f.saved('demo-shape'), 'utf8'), preview.json); assert.deepEqual(readFileSync(f.file), before, 'the organization file is unchanged'); const [again, againBody] = await call(f, `${ORG}/templates`, 'POST', { name: 'demo-shape', digest: preview.digest }); - assert.deepEqual([again, againBody.error], [400, 'invalid-request']); + assert.deepEqual([again, againBody.error], [409, 'template-exists']); const [, list] = await call(f, `${ORG}/templates`); assert.deepEqual(list.templates.map(x => [x.name, x.scope]), [['demo-shape', 'org']]); // The preview and the list went over the read; only the saves used the fenced writer.