curl -v -XPOST -ufedoraAdmin:fedoraAdmin -H"Content-Disposition: attachment; filename=\"postCreate.txt\"" -H"Slug: binary_change_test1" --data-binary "TestString." http://localhost:8080/rest/
curl -v -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 200 OK
< Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Thu, 29-Nov-2018 19:40:56 GMT
< Content-Type: application/x-www-form-urlencoded
< Content-Disposition: attachment; filename="postCreate.txt"; creation-date="Fri, 30 Nov 2018 19:40:34 GMT"; modification-date="Fri, 30 Nov 2018 19:40:34 GMT"; size=11
< Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
< Link: <http://www.w3.org/ns/ldp#NonRDFSource>;rel="type"
< Link: <http://localhost:8080/rest/binary_change_test1/fcr:metadata>; rel="describedby"
< Accept-External-Content-Handling: copy,redirect,proxy
< Allow: DELETE,HEAD,GET,PUT,OPTIONS
< Link: <http://localhost:8080/rest/binary_change_test1/fcr:acl>; rel="acl"
< Cache-Control: no-transform, must-revalidate, max-age=0
< Content-Length: 11
curl -v -XPUT -ufedoraAdmin:fedoraAdmin -H"Content-Disposition: attachment; filename=\"putCreate.txt\"" -H'Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type"' --data-binary "TestString2." http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 204 No Content
curl -v -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 200 OK
< Content-Type: application/x-www-form-urlencoded
< Content-Disposition: attachment; filename="putCreate.txt"; creation-date="Fri, 30 Nov 2018 19:40:34 GMT"; modification-date="Fri, 30 Nov 2018 19:46:08 GMT"; size=12
< Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
< Link: <http://www.w3.org/ns/ldp#NonRDFSource>;rel="type"
< Link: <http://localhost:8080/rest/binary_change_test1/fcr:metadata>; rel="describedby"
# TestString2.
curl -v -XPUT -ufedoraAdmin:fedoraAdmin -H"Content-Disposition: attachment; filename=\"putCreate2.txt\"" -H'Link: <http://www.w3.org/ns/ldp#RDFSource>;rel="type"' --data-binary "TestString3." http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 400 Bad Request
Invalid interaction model: http://www.w3.org/ns/ldp#RDFSource
curl -v -XPUT -ufedoraAdmin:fedoraAdmin -H'Link: <http://www.w3.org/ns/ldp#RDFSource>;rel="type"' http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 400 Bad Request
# Invalid interaction model: http://www.w3.org/ns/ldp#RDFSource
curl -v -XPUT -ufedoraAdmin:fedoraAdmin -H'Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type"' http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 204 No Content
curl -v -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 200 OK
< Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
< Link: <http://www.w3.org/ns/ldp#NonRDFSource>;rel="type"
< Link: <http://localhost:8080/rest/binary_change_test1/fcr:metadata>; rel="describedby"
< Content-Type: application/octet-stream
< Content-Length: 0
Also worth noting is that the Content-Type is no longer
curl -v -XPUT -ufedoraAdmin:fedoraAdmin -H'Link: <http://www.w3.org/ns/ldp#DirectContainer>;rel="type"' http://localhost:8080/rest/binary_change_test1
< HTTP/1.1 409 Conflict
# Changing the interaction model ldp:BasicContainer to ldp:DirectContainer is not allowed!
I also got a 204 response and the same behavior for NonRDFSource to IndirectContainer and DirectContainer. It did not matter if I explicitly provided the NonRDFSource type when creating the binary.
And just to be safe... lets see what happens if creating a child in our NonRDFSource that thinks its a BasicContainer
curl -v -XPUT -ufedoraAdmin:fedoraAdmin http://localhost:8080/rest/binary_change_test1/child
< HTTP/1.1 409 Conflict
Unable to add child /child to resource /binary_change_test1
phew...