fix: Determine body presence according to RFC7230

Fixes https://github.com/solid/community-server/issues/121
This commit is contained in:
Ruben Verborgh
2020-09-03 00:51:40 +02:00
committed by Joachim Van Herwegen
parent ee3b847033
commit a06a7ff685
5 changed files with 48 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
handler,
requestUrl,
'POST',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
);
expect(response.statusCode).toBe(200);
@@ -151,7 +151,7 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
handler,
requestUrl,
'POST',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s1> <http://test.com/p1> <http://test.com/o1>.',
'<http://test.com/s2> <http://test.com/p2> <http://test.com/o2>.' ],
);
@@ -166,7 +166,7 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
handler,
requestUrl,
'PATCH',
{ 'content-type': 'application/sparql-update' },
{ 'content-type': 'application/sparql-update', 'transfer-encoding': 'chunked' },
[ 'DELETE { <http://test.com/s1> <http://test.com/p1> <http://test.com/o1> }',
'INSERT {<http://test.com/s3> <http://test.com/p3> <http://test.com/o3>}',
'WHERE {}' ],

View File

@@ -129,7 +129,7 @@ describe('A server with authorization', (): void => {
handler,
requestUrl,
'POST',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
);
expect(response.statusCode).toBe(200);
@@ -140,7 +140,7 @@ describe('A server with authorization', (): void => {
handler,
requestUrl,
'PUT',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
);
expect(response.statusCode).toBe(200);
@@ -162,7 +162,7 @@ describe('A server with authorization', (): void => {
handler,
requestUrl,
'POST',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
);
expect(response.statusCode).toBe(401);
@@ -173,7 +173,7 @@ describe('A server with authorization', (): void => {
handler,
requestUrl,
'PUT',
{ 'content-type': 'text/turtle' },
{ 'content-type': 'text/turtle', 'transfer-encoding': 'chunked' },
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
);
expect(response.statusCode).toBe(401);

View File

@@ -7,7 +7,7 @@ import { BasicTargetExtractor } from '../../src/ldp/http/BasicTargetExtractor';
import { RawBodyParser } from '../../src/ldp/http/RawBodyParser';
import { HttpRequest } from '../../src/server/HttpRequest';
describe('A SimpleRequestParser with simple input parsers', (): void => {
describe('A BasicRequestParser with simple input parsers', (): void => {
const targetExtractor = new BasicTargetExtractor();
const bodyParser = new RawBodyParser();
const preferenceParser = new AcceptPreferenceParser();
@@ -21,6 +21,7 @@ describe('A SimpleRequestParser with simple input parsers', (): void => {
accept: 'text/turtle; q=0.8',
'accept-language': 'en-gb, en;q=0.5',
'content-type': 'text/turtle',
'transfer-encoding': 'chunked',
host: 'test.com',
};