Skip to content

Commit

Permalink
Merge pull request #91 from nspcc-dev/feature/90-use_new_header_for_size
Browse files Browse the repository at this point in the history
Add x-neofs-payload-length for size object
  • Loading branch information
roman-khimov authored Jun 1, 2023
2 parents f7563d5 + 43d2396 commit 47c275a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ export default function api(method, url, params = {}, headers = {}) {
resolve({ status: 'success' });
} else {
let res = response;
if (method === 'HEAD') {
resolve({
'filename': response.headers ? response.headers.get('X-Attribute-Filename') : '',
'containerId': response.headers ? response.headers.get('X-Container-Id') : '',
'ownerId': response.headers ? response.headers.get('X-Owner-Id') : '',
'size': response.headers ? response.headers.get('Content-Length') : '',
'expirationEpoch': response.headers ? response.headers.get('X-Attribute-Neofs-Expiration-Epoch') : '',
});
if (method === 'HEAD' && response.headers) {
const res = {
'filename': response.headers.get('X-Attribute-Filename'),
'containerId': response.headers.get('X-Container-Id'),
'ownerId': response.headers.get('X-Owner-Id'),
'size': response.headers.get('Content-Length') ? response.headers.get('Content-Length') : response.headers.get('x-neofs-payload-length'),
'expirationEpoch': response.headers.get('X-Attribute-Neofs-Expiration-Epoch'),
}
resolve(res);
} else if (method === 'GET' && url.indexOf(`/gate/get/`) !== -1) {
res = await response.blob();
resolve(res);
Expand Down

0 comments on commit 47c275a

Please sign in to comment.