Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.head does not return content-length header #301

Open
creativityjuice opened this issue Jun 20, 2022 · 1 comment
Open

db.head does not return content-length header #301

creativityjuice opened this issue Jun 20, 2022 · 1 comment

Comments

@creativityjuice
Copy link

Trying to use db.head to get document size fast, it returns headers without content-length. I switched to axios just for that call to access document size.

Here is a simple piece of code :

const db = nano.db.use('accounts');
const nano_account_headers = await db.head('00000000-0000-0000-0000-ffffffffffff');
console.log('nano_account_headers -', nano_account_headers);
const axios_account = await axios.head(`${db_url}/accounts/00000000-0000-0000-0000-ffffffffffff`);
console.log('axios_account.headers -', axios_account.headers);

Expected Behavior

Here is what I get with axios, and therefor have with nano:

axios_account.headers - {
  server: 'nginx',
  date: 'Mon, 20 Jun 2022 13:24:14 GMT',
  'content-type': 'application/json',
  **'content-length': '1156',**
  connection: 'close',
  'cache-control': 'must-revalidate',
  etag: '"xx-xxxxxxxxxxxxxxxxxxxxxxxxx"',
  'x-couch-request-id': 'xxxxxxxxxx',
  'x-couchdb-body-time': '0',
  'strict-transport-security': 'max-age=31536000; includeSubdomains; preload'
}

Current Behavior

Here is what I get with nano:

nano_account_headers - {
  uri: 'https://xxxxxxxx.com/accounts/00000000-0000-0000-0000-ffffffffffff',
  statusCode: 200,
  date: 'Mon, 20 Jun 2022 13:24:14 GMT',
  'content-type': 'application/json',
  connection: 'close',
  'cache-control': 'must-revalidate',
  etag: '"xx-xxxxxxxxxxxxxxxxxxxx"',
  'x-couch-request-id': 'xxxxxxxxxx',
  'x-couchdb-body-time': '0',
  'strict-transport-security': 'max-age=31536000; includeSubdomains; preload'
}

Your Environment

  • Version used: 7.1.1
  • Browser Name and version: Node 16.5.1
  • Operating System and version (desktop or mobile): Ubuntu 20.04
@big-r81
Copy link
Contributor

big-r81 commented Jun 20, 2022

The content-length gets removed, maybe @glynnbird can help why?

@lukashass lukashass mentioned this issue Sep 4, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants