request fn: opt param 💥

This commit is contained in:
Jannis R 2018-06-13 19:30:58 +02:00
parent 8881d8a1a4
commit a45d640272
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 8 additions and 8 deletions

View file

@ -36,7 +36,7 @@ const createClient = (profile, request = _request) => {
const products = profile.formatProductsFilter(opt.products || {})
const dir = opt.direction ? profile.formatStation(opt.direction) : null
return request(profile, {
return request(profile, opt, {
meth: 'StationBoard',
req: {
type: 'DEP',
@ -159,7 +159,7 @@ const createClient = (profile, request = _request) => {
}
if (profile.journeysNumF) query.numF = opt.results
return request(profile, {
return request(profile, opt, {
cfg: {polyEnc: 'GPA'},
meth: 'TripSearch',
req: profile.transformJourneysQuery(query, opt)
@ -210,7 +210,7 @@ const createClient = (profile, request = _request) => {
}, opt)
const f = profile.formatLocationFilter(opt.stations, opt.addresses, opt.poi)
return request(profile, {
return request(profile, opt, {
cfg: {polyEnc: 'GPA'},
meth: 'LocMatch',
req: {input: {
@ -234,7 +234,7 @@ const createClient = (profile, request = _request) => {
else if ('string' === typeof station) station = profile.formatStation(station)
else throw new Error('station must be an object or a string.')
return request(profile, {
return request(profile, opt, {
meth: 'LocDetails',
req: {
locL: [station]
@ -267,7 +267,7 @@ const createClient = (profile, request = _request) => {
stations: true, // return stations?
}, opt)
return request(profile, {
return request(profile, opt, {
cfg: {polyEnc: 'GPA'},
meth: 'LocGeoPos',
req: {
@ -305,7 +305,7 @@ const createClient = (profile, request = _request) => {
opt.when = new Date(opt.when || Date.now())
if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
return request(profile, {
return request(profile, opt, {
cfg: {polyEnc: 'GPA'},
meth: 'JourneyDetails',
req: {
@ -353,7 +353,7 @@ const createClient = (profile, request = _request) => {
if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
const durationPerStep = opt.duration / Math.max(opt.frames, 1) * 1000
return request(profile, {
return request(profile, opt, {
meth: 'JourneyGeoPos',
req: {
maxJny: opt.results,

View file

@ -11,7 +11,7 @@ const {fetch} = require('fetch-ponyfill')({Promise})
const md5 = input => createHash('md5').update(input).digest()
const request = (profile, data) => {
const request = (profile, opt, data) => {
const body = profile.transformReqBody({lang: 'en', svcReqL: [data]})
const req = profile.transformReq({
method: 'post',