Skip to content

Commit

Permalink
fix: Consider all entries with weight 1 to check metadata part in Acc…
Browse files Browse the repository at this point in the history
…ept header
  • Loading branch information
smessie committed Dec 5, 2024
1 parent 6abb9f7 commit 69cc9b8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/LDESStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,8 @@ export class LDESStore implements ResourceStore {
),
);

// Get Content-Type with the highest preference and check if it includes the `metadata+` request.
const highestPreferenceKey = !preferences.type ? '' : Object.entries(preferences.type!).reduce((maxKey, [key, value]) => {
return preferences.type![maxKey] > value ? maxKey : key;
}, Object.keys(preferences.type!)[0]);
const includeMetadata = highestPreferenceKey.includes('/metadata+');
// Get Accept Content-Types with weight 1 and check if it includes the `metadata+` request.
const includeMetadata = Object.entries(preferences.type || {}).filter(([key, value]) => (preferences.type || {})[key] === 1).some(([key, value]) => key.includes("/metadata+"));

members.forEach((m) => this.addMember(quads, m, includeMetadata));
return new BasicRepresentation(guardedStreamFrom(quads), md);
Expand Down

0 comments on commit 69cc9b8

Please sign in to comment.