Get etag from response when using putFileContents
I was wondering if there is a way to get the etag from the response when using putFileContents. I know the value is there from the dev tools network panel, but was unable to find a way to do it when using this package.
Also tried to make it work via customRequest but for some reason the response headers are all empty:
const r = await client.customRequest(path, {
headers: {
'Content-Type': 'application/octet-stream',
...(isOverwrite ? {} : { 'If-None-Match': '*' }),
},
method: 'PUT',
data,
});
console.log(r.headers);
getDirectoryContents can return etags when using options.details: https://github.com/perry-mitchell/webdav-client?tab=readme-ov-file#item-stats
https://github.com/perry-mitchell/webdav-client?tab=readme-ov-file#getdirectorycontents
EDIT: Sorry, just saw putFileContents.. I'm not sure as I don't recall what the response contains. If it contains an etag I'd be happy supporting a detailed mode for its response.. but currently not at the moment.
The response definitely contains one (at least for my nextcloud case), but for the putFileContents there is just a boolean returned. Not sure why the request headers from the customRequest are empty though.
Let me know if I can help! Would be great to have this added!
The headers thing could be CORS.. and if that's the case there's nothing we can do in the client. But I can see adding a detailed response option here being a good idea. I'll try to get to it at some point, if no one else does.