Skip to content

" redirect to the first prefixed locale that matches the requested hostname" test failures #4862

@eladavn

Description

@eladavn

To Reproduce

Step by step instructions to reproduce the behavior:

  1. Clone this repo
  2. npm install
  3. Start local mongodb daemon
  4. npx mocha test/i18n.js
  5. See error

Expected behavior

All tests pass

Describe the bug

Test output:

17 passing (7s)
2 failing

  1. redirection to first locale
    should redirect to the first prefixed locale that matches the requested hostname:
    FetchError: request to http://ca.localhost:37957/ failed, reason: getaddrinfo ENOTFOUND ca.localhost
    at ClientRequest. (node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

  2. no redirection to first locale
    should not redirect to the first prefixed locale that matches the requested hostname when at least one locale has no prefix:
    FetchError: request to http://ca.localhost:36819/ failed, reason: getaddrinfo ENOTFOUND ca.localhost
    at ClientRequest. (node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Details

Version of Node.js:
v18.20.6

Server Operating System:
Ubuntu 24.04.1 LTS on Windows wsl v2

Additional Context:
Mongo v8.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions