File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ class LDP {
3838 constructor ( argv = { } ) {
3939 extend ( this , argv )
4040
41+ // Acl contentType
42+ if ( ! this . aclContentType ) {
43+ this . aclContentType = 'text/turtle'
44+ }
45+
4146 // Suffixes
4247 if ( ! this . suffixAcl ) {
4348 this . suffixAcl = '.acl'
Original file line number Diff line number Diff line change @@ -481,6 +481,12 @@ describe('HTTP APIs', function () {
481481 . set ( 'content-type' , 'text/turtle' )
482482 . expect ( 201 , done )
483483 } )
484+ it ( 'should reject create .acl resource, if contentType not text/turtle' , function ( done ) {
485+ server . put ( '/put-resource-1.acl' )
486+ . send ( putRequestBody )
487+ . set ( 'content-type' , 'text/plain' )
488+ . expect ( 415 , done )
489+ } )
484490 it ( 'should create directories if they do not exist' , function ( done ) {
485491 server . put ( '/foo/bar/baz.ttl' )
486492 . send ( putRequestBody )
@@ -594,6 +600,13 @@ describe('HTTP APIs', function () {
594600 . set ( 'content-type' , '' )
595601 . expect ( 415 , done )
596602 } )
603+ it ( 'should error with 415 if file.acl and contentType not text/turtle' , function ( done ) {
604+ server . post ( '/post-tests/' )
605+ . set ( 'slug' , 'post-acl-no-content-type.acl' )
606+ . send ( postRequest1Body )
607+ . set ( 'content-type' , '' )
608+ . expect ( 415 , done )
609+ } )
597610 it ( 'should create new resource even if no trailing / is in the target' ,
598611 function ( done ) {
599612 server . post ( '' )
Original file line number Diff line number Diff line change @@ -163,6 +163,13 @@ describe('LDP', function () {
163163 assert . equal ( err . status , 415 )
164164 } )
165165 } )
166+
167+ it ( 'should fail if file.acl and content type not text/turtle' , ( ) => {
168+ var stream = stringToStream ( 'hello world' )
169+ return ldp . put ( '/resources/testPut.txt.acl' , stream , 'text/plain' ) . catch ( err => {
170+ assert . equal ( err . status , 415 )
171+ } )
172+ } )
166173 } )
167174
168175 describe ( 'delete' , function ( ) {
You can’t perform that action at this time.
0 commit comments