Changeset 30871c1 in Klonkt for test/c2s-contacts.test.js


Ignore:
Timestamp:
07/20/2026 11:35:45 PM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
562e1b0
Parents:
5143ccf
git-author:
Robin <roboburr@…> (07/20/2026 11:35:44 PM)
git-committer:
Robin <roboburr@…> (07/20/2026 11:35:45 PM)
Message:

Feature: enrichment is opt-in via Prefer (FEP-9876 conformance)

Klonkt is the reference implementation of FEP-9876. The owner
followers/following collections now enrich member representations only
when the client asks with Prefer: return=representation (RFC 7240),
echo Preference-Applied and always set Vary: Prefer; the default is
bare id strings, so the collections match the AP norm and existing
consumers are unaffected. The Prefer predicate is a pure, tested
function.

Changed files:
src/services/ActivityPubService.js

  • prefersEnriched(preferHeader): pure Prefer detector, exported

src/routes/activitypub.js

  • owner followers/following: enrich only on the preference, set Preference-Applied + Vary: Prefer

test/c2s-contacts.test.js

  • prefersEnriched cases

docs/shaer-c2s-api.md

  • document the Prefer opt-in

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/c2s-contacts.test.js

    r5143ccf r30871c1  
    4444  assert.equal(ref.name, 'Dana');
    4545});
     46
     47test('prefersEnriched detects the Prefer opt-in (FEP-9876)', () => {
     48  assert.equal(AP.prefersEnriched('return=representation'), true);
     49  assert.equal(AP.prefersEnriched('return=representation; handling=lenient'), true);
     50  assert.equal(AP.prefersEnriched('foo, return=representation'), true);
     51  assert.equal(AP.prefersEnriched('return=minimal'), false);
     52  assert.equal(AP.prefersEnriched('returnx=representation'), false);
     53  assert.equal(AP.prefersEnriched(''), false);
     54  assert.equal(AP.prefersEnriched(undefined), false);
     55});
Note: See TracChangeset for help on using the changeset viewer.