Code of Conduct: https://github.com/solid/process/blob/main/code-of-conduct.md - Website: https://solidproject.org/ - Repos: https://github.com/solid/
Atm I'm using Java & JavaScript for a lot of things from small 50 people companies, to software thats been key to some projects requiring ~300 mil transactions to be processed in a short amount of time.
Where I'm working on Java, its usually to bridge them to the world of JavaScript
Here's a weird one, working on Plume I'm trying to use solid-auth-client fetch (which maps to rdflib) to overwrite config.json with PUT. The same put() function is used for saving blog posts with '.ttl' extension and content type 'rdf/turtle' and I've also tried saving to a '.txt' file with content type 'text/plain'. Here's the function:
var put = function(url, data, type) {
let contentType = type || 'text/turtle'
var init = {
method: 'PUT',
headers : {
'Content-Type': contentType,
'Content-Length': data.length
},
credentials: 'include',
}
if (data && data.length > 0) {
init['body'] = data;
}
var promise = Solid.fetch(url, init)
.then((resp) => {
if (resp.status === 200 || resp.status === 201) {
return Promise.resolve(parseResponseMeta(resp))
} else {
return Promise.reject({status: resp.status, msg: resp.statusText})
}
})
return promise;
};
When I try to save to a file 'config.json' with content type 'application/json' the response is 200, and the file is overwritten but empty. Just changing the content type to 'text/plain' causes the content to be written to a file with a different name ('config$.txt'). Any ideas?
JSON.stringify(config,null,4)
which looks like this:"{
"owners": [
"https://localhost:8443/profile/card#me"
],
"title": "Plume (sac-smalinin)",
"tagline": "Light as a feather",
"picture": "img/logo.svg",
"fadeText": true,
"showSources": true,
"cacheUnit": "days",
"defaultPath": "public/posts",
"postsURL": "https://localhost:8443/public/posts/",
"saveDate": 1555152421986,
"postsElement": ".posts",
"loadInBg": false
}"
@bourgeoa thanks for looking but I'm using 5.0.1 :wink:
@jeff-zucker 'text/turtle' is the default but I'm specifying 'application/json' for the '.json' file.
It works with config.txt and 'text/plain' but I get a zero length file if I use config.json and 'application/json'.
I'm going to settle for config.txt, but no doubt we'll want to PUT json files at some point.