Titanium JIRA Archive
Appcelerator Daemon (DAEMON)

[DAEMON-201] appcd-client: Accept-Language should not be set if locale is null

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusResolved
ResolutionFixed
Resolution Date2017-12-05T16:18:18.000+0000
Affected Version/sAppc Daemon 1.0.0
Fix Version/sAppc Daemon 1.1.0, Appc Daemon 1.0.1
Componentsappcd-client
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2017-12-04T14:53:43.000+0000
Updated2017-12-12T21:25:24.000+0000

Description

Description

I was reviewing the test failures and noticed some Jenkins machines fail on the below test, as I understand it it's possible for the locale function in appcd-response to return null, so I believe it would make sense for appcd-client to have a default for the Accepts-Language header, which would probably be en or *. Alternatively just fix the regex check to accept null.
 1) Client request() should make a request to the mock server:
     AssertionError: expected 'null' to match /^([a-z]{2})(?:[-_](?:\w+[-_])?([A-Z]{2}))?$/i
      at WebSocket.conn.on.msg (test/test-client.js:159:49)
      at Receiver._receiver.onmessage (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/WebSocket.js:143:47)
      at Receiver.dataMessage (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/Receiver.js:389:14)
      at Receiver.getData (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/Receiver.js:330:12)
      at Receiver.startLoop (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/Receiver.js:165:16)
      at Receiver.add (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/Receiver.js:139:10)
      at Socket._ultron.on (/Users/build/jenkins/workspace/cli_appc-daemon_master-XS2WQ2LFI3NLAO73KGNRAF6P26KUCWWAZBYDRU2BBMG2YHPP363A/node_modules/ws/lib/WebSocket.js:139:22)
      at addChunk (_stream_readable.js:263:12)
      at readableAddChunk (_stream_readable.js:250:11)
      at Socket.Readable.push (_stream_readable.js:208:10)
      at TCP.onread (net.js:594:20)

Comments

  1. Chris Barber 2017-12-04

    locale() returning null is valid. appcd-client should probably only set the Accept-Language if the locale is not null. Internally, the WebSocketSession will pass the Accept-Language value to the appcd-response Message.toString() which in turn tolerates null locales. So this ticket comes down to not setting the locale if it's null and fixing the unit test in the event locale is null.
  2. Ewan Harris 2017-12-05

    https://github.com/appcelerator/appc-daemon/pull/220
  3. Chris Barber 2017-12-12

    1_0_X backport: https://github.com/appcelerator/appc-daemon/pull/247

JSON Source