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)
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
.https://github.com/appcelerator/appc-daemon/pull/220
1_0_X backport: https://github.com/appcelerator/appc-daemon/pull/247