Open
Description
From my testing (test attached below) I notice these differences:
POST "foo", no content-type
4.x : "foo" text/turtle
5.x : 500
POST "foo.ttl", no content-type
4.x : "foo.ttl" text/turtle
5.x : 500
POST "foo", content-type=text/turtle
4.x : "foo" text/turtle
5.x : "foo.ttl" text/turtle
POST "foo.ttl", content-type=text/turtle
4.x : "foo.ttl.ttl" text/turtle
5.x : "foo.ttl.ttl" text/turtle
Here's the test. I ran it against solid.community for 5.x and against solid.openlinksw.com:8444 for 4.x
const auth = require('solid-auth-cli')
const text = "<> a <#test>."
const idp = "https://jeffz.solid.community"
const base = idp + "/public/nss5-test/"
const file = "test-file"
async function main(){
let session = await auth.login()
console.log("Logged in as <"+session.webId+">")
console.log("Using folder <"+base+">\n")
await test({
label : "POST, no content-type",
extension : "",
contentType : ""
})
await test({
label : "POST content-type=text/turtle",
extension : "",
contentType : "text/turtle"
})
await test({
label : "POST, no content-type",
extension : ".ttl",
contentType : ""
})
}
async function test(opts){
let url = file + opts.extension
console.log(" ",opts.label,"<"+url+">")
let headers = {
link : '<http://www.w3.org/ns/ldp#Resource>; rel="type"',
slug : url,
}
if(opts.contentType) headers["Content-type"]=opts.contentType
let res = await auth.fetch( base, {
method:"POST",
body:text,
headers:headers
})
if(!res.ok){
console.log(" ",res.status,res.statusText)
return
}
let location = idp + res.headers.get("location")
res = await auth.fetch( location )
location = location.replace(base,'')
if(res.ok) console.log(
" ",
res.status,
res.headers.get("content-type"),
location
)
else console.log(" ",res.status,res.statusText)
}
main()
Activity