mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
lib/request: add profile.(auth|client|ext|ver) to request
This commit is contained in:
parent
4ee062a19d
commit
51af991e38
1 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ const DEBUG = /\bhafas-client\b/.test(process.env.DEBUG || '')
|
||||||
|
|
||||||
const {randomBytes} = require('crypto')
|
const {randomBytes} = require('crypto')
|
||||||
const createHash = require('create-hash')
|
const createHash = require('create-hash')
|
||||||
|
const pick = require('lodash/pick')
|
||||||
const captureStackTrace = DEV ? require('capture-stack-trace') : () => {}
|
const captureStackTrace = DEV ? require('capture-stack-trace') : () => {}
|
||||||
const {stringify} = require('qs')
|
const {stringify} = require('qs')
|
||||||
const ProxyAgent = require('https-proxy-agent')
|
const ProxyAgent = require('https-proxy-agent')
|
||||||
|
@ -32,6 +33,12 @@ const request = (ctx, userAgent, reqData) => {
|
||||||
lang: opt.language || 'en',
|
lang: opt.language || 'en',
|
||||||
svcReqL: [reqData]
|
svcReqL: [reqData]
|
||||||
})
|
})
|
||||||
|
Object.assign(body, pick(profile, [
|
||||||
|
'client', // client identification
|
||||||
|
'ext', // ?
|
||||||
|
'ver', // HAFAS protocol version
|
||||||
|
'auth', // static authentication
|
||||||
|
]))
|
||||||
if (DEBUG) console.error(JSON.stringify(body))
|
if (DEBUG) console.error(JSON.stringify(body))
|
||||||
|
|
||||||
const req = profile.transformReq(ctx, {
|
const req = profile.transformReq(ctx, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue