Skip to content

Add Koa middleware#2

Open
Lasalot wants to merge 5 commits into
mainfrom
add-prerender-koa
Open

Add Koa middleware#2
Lasalot wants to merge 5 commits into
mainfrom
add-prerender-koa

Conversation

@Lasalot
Copy link
Copy Markdown
Collaborator

@Lasalot Lasalot commented Apr 21, 2026

Initial implementation of the Prerender.io integration for koa.

Comment thread index.js
headers['X-Prerender-Int-Type'] = 'Koa';
const response = await fetch(apiUrl, { headers, redirect: 'manual' });
const body = await response.text();
return { status: response.status, body };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Hapi one returns the forwarded headers, is it intentional?

Comment thread index.js
return { status: response.status, body };
}

module.exports = function prerenderMiddleware(options = {}) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no beforeRender/afterRender hooks. The Hapi plugin has them; this one doesn't, is it intentional?

Comment thread package.json
],
"repository": {
"type": "git",
"url": "git://github.com/prerender/integrations",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should be prerender/koa

Comment thread package.json
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be missing

"files": ["index.js"]

if we publish on npm

Marcin and others added 3 commits May 13, 2026 12:02
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Asserts the outgoing wire-protocol shape (URL composition, required
and optional headers, X-Prerender-Int-Type value, query-string
preservation) — surfaces that no other integration's smoke tests cover.

Mock server lives at prerender/integration-contract and is fetched in
CI before tests run. Local devs fetch it once with the curl snippet
in test/contract.test.js; .gitignore keeps it out of source control.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lets the backend correlate requests with a specific integration version
and uniquely identify each request for support triage. Contract tests
assert presence, format, and per-request uniqueness.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants