Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jul 26, 2023
1 parent 72f7052 commit 3445d1f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const defaultConfig = {
mapRouteParsers: (route, parsers) => parsers,
mapRouteOpenapiPaths: (route, openapiPaths) => openapiPaths,
addHafasOpts: (opt, method, req) => {
// todo: once cached-hafas-client supports specifying a max age, read it from Cache-Control: max-age/max-stale and pass it in
if (['no-cache', 'no-store'].includes(req.headers['cache-control'])) {
opt[CACHED] = false
}
Expand Down
1 change: 1 addition & 0 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const parseQuery = (params, query) => {
const res = Object.create(null)

for (const [key, param] of Object.entries(params)) {
// todo: make .default a function
if ('default' in param) res[key] = param.default
}
for (const key of Object.keys(query)) {
Expand Down
2 changes: 1 addition & 1 deletion routes/journeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const createJourneysRoute = (hafas, config) => {
arrival: {
description: 'Compute journeys arriving at this date/time. Mutually exclusive with `departure`.',
type: 'date+time',
defaultStr: '*now*',
defaultStr: '',
parse: parseWhen(hafas.profile.timezone),
},
earlierThan: {
Expand Down
2 changes: 1 addition & 1 deletion routes/trips.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const createTripsRoute = (hafas, config) => {
untilWhen: {
description: 'Together with fromWhen, forms a time frame to get trips for. Mutually exclusive with `when`.',
type: 'date+time',
defaultStr: '*now*',
defaultStr: '',
parse: parseWhen(hafas.profile.timezone),
},
onlyCurrentlyRunning: {
Expand Down

0 comments on commit 3445d1f

Please sign in to comment.