|
15 | 15 | * | `GET ?$count=maybe`, `?$count=1`, `?count=` (with `$top`) | 200, `total` reported | 400 naming the spelling | |
16 | 16 | * | `POST {"select":""}`, `{"fields":[]}` | 200, every column | 400 naming the key | |
17 | 17 | * | `POST {"count":"maybe"}` | 400 `VALIDATION_FAILED` (the body schema) | unchanged | |
18 | | - * | `GET /:id?select=`, `?select=,` | 200, every column | 400 naming `select` | |
| 18 | + * | `GET /:id?select=`, `?select=,` | 200, every column | `VALIDATION_ERROR` naming `select`, at this route's 404 (it rewrites every 400, as for `?select=nope`) | |
19 | 19 | * | `GET ?$select=label`, `?$count=true` / `false`, absent; `GET /:id?select=label` | 200 | unchanged | |
20 | 20 | * |
21 | 21 | * The per-spelling pin with a recording engine is `metadata-protocol`'s |
@@ -167,11 +167,17 @@ describe('[#26644] an empty projection and an unrecognised count flag on the Dat |
167 | 167 | expect(res.body.code).toBe('VALIDATION_FAILED'); |
168 | 168 | }); |
169 | 169 |
|
170 | | - it('GET by id: 400 VALIDATION_ERROR naming `select` — no read', async () => { |
| 170 | + it("GET by id: VALIDATION_ERROR naming `select`, at the status this route gives every projection refusal — no read", async () => { |
| 171 | + // This route's catch rewrites every 400 into a 404 (`crud-routes.ts`: "a |
| 172 | + // bad id is a miss"), so its projection refusals already answer 404 — an |
| 173 | + // unknown `select` field included. The empty projection joins that answer |
| 174 | + // rather than inventing a second one here; the code is what differs. |
| 175 | + const unknownField = await byId({ select: 'nope' }); |
| 176 | + expect(unknownField.body.code, JSON.stringify(unknownField.body)).toBe('INVALID_FIELD'); |
171 | 177 | const before = reads.n; |
172 | 178 | for (const select of ['', ',']) { |
173 | 179 | const res = await byId({ select }); |
174 | | - expect(res.status, `select=${JSON.stringify(select)}: ${JSON.stringify(res.body)}`).toBe(400); |
| 180 | + expect(res.status, `select=${JSON.stringify(select)}: ${JSON.stringify(res.body)}`).toBe(unknownField.status); |
175 | 181 | expect(res.body.code).toBe('VALIDATION_ERROR'); |
176 | 182 | expect(res.body.error).toContain("Query parameter 'select' names no field"); |
177 | 183 | } |
|
0 commit comments