Files
Cursor Agentandz 1fc92a04b3 Serve the Postiz door on social.hanzo.ai from the edge worker.
The hostname still points at the static origin. The worker answers only
the Postiz paths, with the same handler the process uses, so Grok can
connect there while /v1/social stays the Hanzo API.

Co-authored-by: z <[email protected]>
2026-10-26 18:00:21 +00:00

19 lines
704 B
JavaScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { handleEdgeRequest } from './edge.mjs'
test('the edge answers Postiz with JSON instead of the SPA', async () => {
const response = await handleEdgeRequest(
new Request('https://social.hanzo.ai/mcp', {
method: 'POST',
headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream' },
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }),
}),
)
assert.equal(response.status, 401)
assert.match(response.headers.get('content-type'), /application\/json/)
const body = await response.json()
assert.match(body.message, /rejected this API key/)
})