@@ -124,7 +124,7 @@ describe('LDP', function () {
124124 describe ( 'put' , function ( ) {
125125 it . skip ( 'should write a file in an existing dir' , ( ) => {
126126 var stream = stringToStream ( 'hello world' )
127- return ldp . put ( '/resources/testPut.txt' , stream ) . then ( ( ) => {
127+ return ldp . put ( '/resources/testPut.txt' , stream , 'text/plain' ) . then ( ( ) => {
128128 var found = read ( 'testPut.txt' )
129129 rm ( 'testPut.txt' )
130130 assert . equal ( found , 'hello world' )
@@ -133,11 +133,12 @@ describe('LDP', function () {
133133
134134 it ( 'should fail if a trailing `/` is passed' , ( ) => {
135135 var stream = stringToStream ( 'hello world' )
136- return ldp . put ( '/resources/' , stream ) . catch ( err => {
136+ return ldp . put ( '/resources/' , stream , 'text/plain' ) . catch ( err => {
137137 assert . equal ( err . status , 409 )
138138 } )
139139 } )
140140
141+
141142 it . skip ( 'with a larger file to exceed allowed quota' , function ( ) {
142143 var randstream = stringToStream ( randomBytes ( 2100 ) )
143144 return ldp . put ( 'localhost' , '/resources/testQuota.txt' , randstream ) . catch ( ( err ) => {
@@ -150,6 +151,20 @@ describe('LDP', function () {
150151 assert . equal ( err . status , 413 )
151152 } )
152153 } )
154+
155+ it ( 'should fail if a trailing `/` is passed without content type' , ( ) => {
156+ var stream = stringToStream ( 'hello world' )
157+ return ldp . put ( '/resources/' , stream , null ) . catch ( err => {
158+ assert . equal ( err . status , 409 )
159+ } )
160+ } )
161+
162+ it ( 'should fail if no content type is passed' , ( ) => {
163+ var stream = stringToStream ( 'hello world' )
164+ return ldp . put ( '/resources/testPut.txt' , stream , null ) . catch ( err => {
165+ assert . equal ( err . status , 415 )
166+ } )
167+ } )
153168 } )
154169
155170 describe ( 'delete' , function ( ) {
@@ -160,7 +175,7 @@ describe('LDP', function () {
160175 it . skip ( 'should delete a file in an existing dir' , async ( ) => {
161176 // First create a dummy file
162177 var stream = stringToStream ( 'hello world' )
163- await ldp . put ( '/resources/testPut.txt' , stream )
178+ await ldp . put ( '/resources/testPut.txt' , stream , 'text/plain' )
164179 // Make sure it exists
165180 fs . stat ( ldp . resourceMapper . _rootPath + '/resources/testPut.txt' , function ( err ) {
166181 if ( err ) {
@@ -181,7 +196,7 @@ describe('LDP', function () {
181196 it . skip ( 'should fail to delete a non-empty folder' , async ( ) => {
182197 // First create a dummy file
183198 var stream = stringToStream ( 'hello world' )
184- await ldp . put ( '/resources/dummy/testPutBlocking.txt' , stream )
199+ await ldp . put ( '/resources/dummy/testPutBlocking.txt' , stream , 'text/plain' )
185200 // Make sure it exists
186201 fs . stat ( ldp . resourceMapper . _rootPath + '/resources/dummy/testPutBlocking.txt' , function ( err ) {
187202 if ( err ) {
@@ -196,7 +211,7 @@ describe('LDP', function () {
196211 it . skip ( 'should fail to delete nested non-empty folders' , async ( ) => {
197212 // First create a dummy file
198213 var stream = stringToStream ( 'hello world' )
199- await ldp . put ( '/resources/dummy/dummy2/testPutBlocking.txt' , stream )
214+ await ldp . put ( '/resources/dummy/dummy2/testPutBlocking.txt' , stream , 'text/plain' )
200215 // Make sure it exists
201216 fs . stat ( ldp . resourceMapper . _rootPath + '/resources/dummy/dummy2/testPutBlocking.txt' , function ( err ) {
202217 if ( err ) {
0 commit comments