Skip to content

Conversation

CxRes
Copy link

@CxRes CxRes commented Aug 28, 2024

When a new resource is created as a result of PATCH, allow 201 as a valid status code.

When a new resource is created as a result of PATCH, allow 201 as a valid status code.
@@ -386,7 +386,7 @@ describe('Create', () => {
"<#patch> a solid:InsertDeletePatch;\n" +
" solid:inserts { <#hello> <#linked> <#world> .}.\n",
});
expect(result.status).toEqual(200);
expect(responseCodeGroup(result.status)).toEqual('2xx');
Copy link

Choose a reason for hiding this comment

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

Is this valid -- looks odd: toEqual('2xx') .. surely toequal does not use 'x' as wildcard.. maybe say toEqual('201') or maybe toMatch(/20./) ?

Copy link

Choose a reason for hiding this comment

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

Or maybe toStartWith('2') ?

Copy link
Member

Choose a reason for hiding this comment

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

This is the function used

export function responseCodeGroup(code) {
return `${Math.floor(code / 100)}xx`;
}

@bourgeoa bourgeoa merged commit a18d54f into solid-contrib:patchAppendNewDocument Aug 30, 2024
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.

3 participants