@smpx/koa-request 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Request.js +17 -10
- package/package.json +1 -1
package/Request.js
CHANGED
|
@@ -1403,16 +1403,23 @@ class Request {
|
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
1405
|
handlePlatformModification() {
|
|
1406
|
-
|
|
1407
|
-
if (this.isMobileApp())
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1406
|
+
let setPlatformCookie = false;
|
|
1407
|
+
if (!this.isMobileApp()) {
|
|
1408
|
+
// don't change platform in mobile apps from query or cookie
|
|
1409
|
+
const platform = this.ctx.query[PLATFORM_PARAM] || this.cookie(PLATFORM_COOKIE);
|
|
1410
|
+
setPlatformCookie = this.setPlatform(platform);
|
|
1411
|
+
if (setPlatformCookie) {
|
|
1412
|
+
this.cookie(PLATFORM_COOKIE, platform, {
|
|
1413
|
+
maxAge: PLATFORM_COOKIE_DURATION,
|
|
1414
|
+
domain: '*',
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
if (!setPlatformCookie) {
|
|
1419
|
+
const smPlatform = this.header('x-sm-platform');
|
|
1420
|
+
if (smPlatform) {
|
|
1421
|
+
this._platform = smPlatform;
|
|
1422
|
+
}
|
|
1416
1423
|
}
|
|
1417
1424
|
}
|
|
1418
1425
|
|