fix(webui): template save maps the new template-exists refusal to 409, not outcome-unknown (#1873)
f6c added template-exists for a save under a taken name. The template route had no entry for it, so a duplicate save answered 503 outcome-unknown. Map it to 409 and move the SP8 pin.
This commit was merged in pull request #1962.
This commit is contained in:
1 parent
211b32ef1a
commit
65f7288cea
2 files changed
+2
-2
No files matched your search
@@ -28,7 +28,7 @@ const LIMIT = 4096;
|
|||||||
const codes = {
|
const codes = {
|
||||||
'invalid-request': 400, 'template-secret-suspected': 400, 'starter-pack-invalid': 400,
|
'invalid-request': 400, 'template-secret-suspected': 400, 'starter-pack-invalid': 400,
|
||||||
'project-not-found': 404,
|
'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,
|
'human-required': 403, 'read-only': 403,
|
||||||
'not-configured': 503, 'no-bus-host': 503,
|
'not-configured': 503, 'no-bus-host': 503,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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.equal(readFileSync(f.saved('demo-shape'), 'utf8'), preview.json);
|
||||||
assert.deepEqual(readFileSync(f.file), before, 'the organization file is unchanged');
|
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 });
|
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`);
|
const [, list] = await call(f, `${ORG}/templates`);
|
||||||
assert.deepEqual(list.templates.map(x => [x.name, x.scope]), [['demo-shape', 'org']]);
|
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.
|
// The preview and the list went over the read; only the saves used the fenced writer.
|
||||||
|
|||||||
Reference in new issue
Block a user