feat: Return correct status codes for invalid requests

This commit is contained in:
Joachim Van Herwegen
2022-01-14 14:54:28 +01:00
parent bc6203f3e8
commit 1afed65368
12 changed files with 179 additions and 17 deletions

View File

@@ -386,4 +386,14 @@ describe.each(stores)('An LDP handler allowing all requests %s', (name, { storeC
// DELETE
expect(await deleteResource(documentUrl)).toBeUndefined();
});
it('returns 405 for unsupported methods.', async(): Promise<void> => {
const response = await fetch(baseUrl, { method: 'TRACE' });
expect(response.status).toBe(405);
});
it('returns 415 for unsupported PATCH types.', async(): Promise<void> => {
const response = await fetch(baseUrl, { method: 'PATCH', headers: { 'content-type': 'text/plain' }, body: 'abc' });
expect(response.status).toBe(415);
});
});