nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: solid/community-server
Pull request #532 (2021-01-20 17:53:51)

Set the Vary header


Patch:
diff --git a/config/presets/middleware.json b/config/presets/middleware.json
index 24d7de715..e1aa24a0e 100644
--- a/config/presets/middleware.json
+++ b/config/presets/middleware.json
@@ -25,6 +25,10 @@
         {
           "@type": "HeaderHandler",
           "HeaderHandler:_headers": [
+            {
+              "HeaderHandler:_headers_key": "Vary",
+              "HeaderHandler:_headers_value": "Accept,Authorization,Origin"
+            },
             {
               "HeaderHandler:_headers_key": "X-Powered-By",
               "HeaderHandler:_headers_value": "Community Solid Server"


Test patch:
diff --git a/test/integration/Middleware.test.ts b/test/integration/Middleware.test.ts
index 7398acd26..ad73836ad 100644
--- a/test/integration/Middleware.test.ts
+++ b/test/integration/Middleware.test.ts
@@ -34,6 +34,27 @@ describe('An Express server with middleware', (): void => {
     server.close();
   });
 
+  it('sets a Vary header containing Accept.', async(): Promise<void> => {
+    const res = await request(server).get('/');
+    expect(res.header).toEqual(expect.objectContaining({
+      vary: expect.stringMatching(/(^|,)\s*Accept\s*(,|$)/iu),
+    }));
+  });
+
+  it('sets a Vary header containing Authorization.', async(): Promise<void> => {
+    const res = await request(server).get('/');
+    expect(res.header).toEqual(expect.objectContaining({
+      vary: expect.stringMatching(/(^|,)\s*Authorization\s*(,|$)/iu),
+    }));
+  });
+
+  it('sets a Vary header containing Origin.', async(): Promise<void> => {
+    const res = await request(server).get('/');
+    expect(res.header).toEqual(expect.objectContaining({
+      vary: expect.stringMatching(/(^|,)\s*Origin\s*(,|$)/iu),
+    }));
+  });
+
   it('sends server identification in the X-Powered-By header.', async(): Promise<void> => {
     const res = await request(server).get('/');
     expect(res.header).toEqual(expect.objectContaining({
Repository: solid/community-server
Pull request #706 (2021-04-26 14:13:18)

Improve identifier error messages
In order to make issues such as #703 easier to understand.


Patch:
diff --git a/src/util/identifiers/BaseIdentifierStrategy.ts b/src/util/identifiers/BaseIdentifierStrategy.ts
index d87e989f5..529a7fae4 100644
--- a/src/util/identifiers/BaseIdentifierStrategy.ts
+++ b/src/util/identifiers/BaseIdentifierStrategy.ts
@@ -13,10 +13,10 @@ export abstract class BaseIdentifierStrategy implements IdentifierStrategy {
 
   public getParentContainer(identifier: ResourceIdentifier): ResourceIdentifier {
     if (!this.supportsIdentifier(identifier)) {
-      throw new InternalServerError(`${identifier.path} is not supported`);
+      throw new InternalServerError(`The identifier ${identifier.path} is outside the configured identifier space.`);
     }
     if (this.isRootContainer(identifier)) {
-      throw new InternalServerError(`${identifier.path} is a root container and has no parent`);
+      throw new InternalServerError(`Cannot obtain the parent of ${identifier.path} because it is a root container.`);
     }
 
     // Trailing slash is necessary for URL library


Test patch:
diff --git a/test/unit/util/identifiers/BaseIdentifierStrategy.test.ts b/test/unit/util/identifiers/BaseIdentifierStrategy.test.ts
index 5e03c8905..5686bf39d 100644
--- a/test/unit/util/identifiers/BaseIdentifierStrategy.test.ts
+++ b/test/unit/util/identifiers/BaseIdentifierStrategy.test.ts
@@ -21,11 +21,11 @@ describe('A BaseIdentifierStrategy', (): void => {
 
   it('errors when attempting to get the parent of an unsupported identifier.', async(): Promise<void> => {
     expect((): any => strategy.getParentContainer({ path: '/unsupported' }))
-      .toThrow('/unsupported is not supported');
+      .toThrow('The identifier /unsupported is outside the configured identifier space.');
   });
 
   it('errors when attempting to get the parent of a root container.', async(): Promise<void> => {
     expect((): any => strategy.getParentContainer({ path: 'http://test.com/root' }))
-      .toThrow('http://test.com/root is a root container and has no parent');
+      .toThrow('Cannot obtain the parent of http://test.com/root because it is a root container.');
   });
 });