Construction mode hides pages from Markdown, MCP and search; MCP rejects non-object messages
createContentHelpers exposes isPathVisible (built from getConstructionMode) and passes it to markdownRoute and mcpPOST; createSearchRoute, createMcpRoute and createMarkdownRoute accept it. A null/number/string JSON-RPC message now gets -32600 instead of crashing the route. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a72ebfaff
commit
7c05a1dba9
@@ -104,6 +104,16 @@ describe('createMcpRoute', () => {
|
||||
expect((await mcp.GET()).status).toBe(405)
|
||||
})
|
||||
|
||||
test('a null, number or string message gets Invalid Request, not a 500', async () => {
|
||||
for (const body of [null, 42, 'x']) {
|
||||
const res = await rpc(body)
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.body.error.code).toBe(-32600)
|
||||
}
|
||||
const batch = await rpc([null, { id: 2, jsonrpc: '2.0', method: 'ping' }])
|
||||
expect(batch.body.map((m: { error?: { code: number } }) => m.error?.code ?? 'ok')).toEqual([-32600, 'ok'])
|
||||
})
|
||||
|
||||
test('rate limit counts every message in a batch', async () => {
|
||||
const ip = '10.9.9.9'
|
||||
const batch = Array.from({ length: 10 }, (_, i) => ({ id: i, jsonrpc: '2.0', method: 'ping' }))
|
||||
|
||||
Reference in New Issue
Block a user