[DAEMON-201] appcd-client: Accept-Language should not be set if locale is null
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | None |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2017-12-05T16:18:18.000+0000 |
Affected Version/s | Appc Daemon 1.0.0 |
Fix Version/s | Appc Daemon 1.1.0, Appc Daemon 1.0.1 |
Components | appcd-client |
Labels | n/a |
Reporter | Ewan Harris |
Assignee | Ewan Harris |
Created | 2017-12-04T14:53:43.000+0000 |
Updated | 2017-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 been
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
- Chris Barber 2017-12-04
locale()
returningnull
is valid.appcd-client
should probably only set theAccept-Language
if the locale is notnull
. Internally, theWebSocketSession
will pass theAccept-Language
value to theappcd-response
Message.toString()
which in turn toleratesnull
locales. So this ticket comes down to not setting the locale if it'snull
and fixing the unit test in the event locale isnull
. - Ewan Harris 2017-12-05 https://github.com/appcelerator/appc-daemon/pull/220
- Chris Barber 2017-12-12 1_0_X backport: https://github.com/appcelerator/appc-daemon/pull/247