Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow server to send 201 on PATCH create #57

Merged

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