Skip to content

Commit 4751df3

Browse files
committed
PKP: fix by using a specific User-Agent 🐛
1 parent faef854 commit 4751df3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

p/pkp/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,27 @@ import {parseLocation} from '../../parse/location.js';
99
const baseProfile = require('./base.json');
1010
import {products} from './products.js';
1111

12+
// https://github.com/public-transport/hafas-client/issues/184#issuecomment-2646119337
13+
const PKP_USER_AGENT = 'Dalvik/2.1.0';
14+
1215
const trimStopName = ({parsed}, l) => {
1316
if (parsed.type === 'stop' || parsed.type === 'station' && parsed.name) {
1417
parsed.name = parsed.name.replace(/(^-|-$)/g, '');
1518
}
1619
return parsed;
1720
};
1821

22+
const transformReqOverrideUserAgent = (ctx, req) => {
23+
req.headers['user-agent'] = PKP_USER_AGENT
24+
return req
25+
}
26+
1927
const profile = {
2028
...baseProfile,
2129
locale: 'pl-PL',
2230
timezone: 'Europe/Warsaw',
31+
randomizeUserAgent: false,
32+
transformReq: transformReqOverrideUserAgent,
2333

2434
products,
2535

0 commit comments

Comments
 (0)