diff --git a/backend/test/nodeinfo.spec.ts b/backend/test/nodeinfo.spec.ts index 78b8a7b..c3b8e28 100644 --- a/backend/test/nodeinfo.spec.ts +++ b/backend/test/nodeinfo.spec.ts @@ -2,6 +2,7 @@ import { strict as assert } from 'node:assert/strict' import * as nodeinfo_21 from 'wildebeest/functions/nodeinfo/2.1' import * as nodeinfo_20 from 'wildebeest/functions/nodeinfo/2.0' import * as nodeinfo from 'wildebeest/functions/.well-known/nodeinfo' +import { assertCORS } from './utils' const domain = 'example.com' @@ -9,6 +10,7 @@ describe('NodeInfo', () => { test('well-known returns links', async () => { const res = await nodeinfo.handleRequest(domain) assert.equal(res.status, 200) + assertCORS(res) const data = await res.json() assert.equal(data.links.length, 2) @@ -17,6 +19,7 @@ describe('NodeInfo', () => { test('expose NodeInfo version 2.0', async () => { const res = await nodeinfo_20.handleRequest() assert.equal(res.status, 200) + assertCORS(res) const data = await res.json() assert.equal(data.version, '2.0') @@ -25,6 +28,7 @@ describe('NodeInfo', () => { test('expose NodeInfo version 2.1', async () => { const res = await nodeinfo_21.handleRequest() assert.equal(res.status, 200) + assertCORS(res) const data = await res.json() assert.equal(data.version, '2.1') diff --git a/functions/.well-known/nodeinfo.ts b/functions/.well-known/nodeinfo.ts index 470d987..d32c191 100644 --- a/functions/.well-known/nodeinfo.ts +++ b/functions/.well-known/nodeinfo.ts @@ -1,6 +1,8 @@ import type { Env } from 'wildebeest/backend/src/types/env' +import { cors } from 'wildebeest/backend/src/utils/cors' const headers = { + ...cors(), 'content-type': 'application/json', 'cache-control': 'max-age=259200, public', } diff --git a/functions/nodeinfo/2.0.ts b/functions/nodeinfo/2.0.ts index d21fac3..afcb1ef 100644 --- a/functions/nodeinfo/2.0.ts +++ b/functions/nodeinfo/2.0.ts @@ -1,7 +1,9 @@ import type { Env } from 'wildebeest/backend/src/types/env' import { WILDEBEEST_VERSION } from 'wildebeest/config/versions' +import { cors } from 'wildebeest/backend/src/utils/cors' const headers = { + ...cors(), 'content-type': 'application/json', 'cache-control': 'max-age=259200, public', } diff --git a/functions/nodeinfo/2.1.ts b/functions/nodeinfo/2.1.ts index 5c88ea8..16cc798 100644 --- a/functions/nodeinfo/2.1.ts +++ b/functions/nodeinfo/2.1.ts @@ -1,7 +1,9 @@ import type { Env } from 'wildebeest/backend/src/types/env' +import { cors } from 'wildebeest/backend/src/utils/cors' import { WILDEBEEST_VERSION } from 'wildebeest/config/versions' const headers = { + ...cors(), 'content-type': 'application/json', 'cache-control': 'max-age=259200, public', }