openvibers/openrestream Commits
Answer /index.md and /updates.md, the Markdown twins llms.txt links (#241)
Changes
@@@ -33,6 +33,9 @@ function captureResponse() {getHeader(name) { return this.headers[String(name)]; },get(name) { return this.headers[String(name)]; },removeHeader(name) { delete this.headers[String(name)]; },++ // The page's cache policy varies on Cookie (server/ui/routes.js page()); a twin is rendered from the same++ // page code, so the capture has to answer it.++ vary() { return this; },type(value) { this.headers['Content-Type'] = value === 'html' ? 'text/html; charset=utf-8' : String(value); return this; },location(url) { this.headers.Location = url; return this; },send(body) { this.body = body; this.headersSent = true; return this; },@@@ -88,6 +88,21 @@ t('llms-full.txt (SEO-33): the site in full, from the same descriptor as llms.tx}});++t('the twins llms.txt links answer Markdown, headed like their pages', async () => {++ const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });++ try {++ for (const [path, heading] of [['/index.md', /# Go live once\.\s+Stream everywhere\./], ['/updates.md', /# What shipped on OpenRestream/]]) {++ const r = await request(api.base, 'GET', path, { headers: { Accept: 'text/html' } });++ assert.strictEqual(r.status, 200, `${path} answers 200`);++ assert.match(r.headers.get('content-type'), /^text\/markdown/, `${path} is Markdown`);++ assert.ok(r.text.startsWith('---\ntitle:'), `${path} carries the page title`);++ assert.match(r.text, heading, `${path} names the page heading`);++ }++ } finally {++ await api.close();++ }++});++t('the front page leads with open restreaming, links to Live for browser go-live, and says what runs here', async () => {const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });try {
@@ -33,6 +33,9 @@ function captureResponse() {
@@ -33,6 +33,9 @@ function captureResponse() {
getHeader(name) { return this.headers[String(name)]; },
getHeader(name) { return this.headers[String(name)]; },
get(name) { return this.headers[String(name)]; },
get(name) { return this.headers[String(name)]; },
removeHeader(name) { delete this.headers[String(name)]; },
removeHeader(name) { delete this.headers[String(name)]; },
+ // The page's cache policy varies on Cookie (server/ui/routes.js page()); a twin is rendered from the same
+ // page code, so the capture has to answer it.
+ vary() { return this; },
type(value) { this.headers['Content-Type'] = value === 'html' ? 'text/html; charset=utf-8' : String(value); return this; },
type(value) { this.headers['Content-Type'] = value === 'html' ? 'text/html; charset=utf-8' : String(value); return this; },
location(url) { this.headers.Location = url; return this; },
location(url) { this.headers.Location = url; return this; },
send(body) { this.body = body; this.headersSent = true; return this; },
send(body) { this.body = body; this.headersSent = true; return this; },
@@ -88,6 +88,21 @@ t('llms-full.txt (SEO-33): the site in full, from the same descriptor as llms.tx
@@ -88,6 +88,21 @@ t('llms-full.txt (SEO-33): the site in full, from the same descriptor as llms.tx
}
}
});
});
+t('the twins llms.txt links answer Markdown, headed like their pages', async () => {
+ const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });
+ try {
+ for (const [path, heading] of [['/index.md', /# Go live once\.\s+Stream everywhere\./], ['/updates.md', /# What shipped on OpenRestream/]]) {
+ const r = await request(api.base, 'GET', path, { headers: { Accept: 'text/html' } });
+ assert.strictEqual(r.status, 200, `${path} answers 200`);
+ assert.match(r.headers.get('content-type'), /^text\/markdown/, `${path} is Markdown`);
+ assert.ok(r.text.startsWith('---\ntitle:'), `${path} carries the page title`);
+ assert.match(r.text, heading, `${path} names the page heading`);
+ }
+ } finally {
+ await api.close();
+ }
+});
+
t('the front page leads with open restreaming, links to Live for browser go-live, and says what runs here', async () => {
t('the front page leads with open restreaming, links to Live for browser go-live, and says what runs here', async () => {
const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });
const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });
try {
try {