Include request parameters in input(...) sources; bump version

This commit is contained in:
Garrett Mills 2022-03-30 15:35:09 -05:00
parent 153f8f7685
commit 467721f775
2 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@extollo/lib", "name": "@extollo/lib",
"version": "0.9.5", "version": "0.9.6",
"description": "The framework library that lifts up your code.", "description": "The framework library that lifts up your code.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@ -7,6 +7,7 @@ import * as url from 'url'
import {Response} from './Response' import {Response} from './Response'
import * as Negotiator from 'negotiator' import * as Negotiator from 'negotiator'
import {HTTPError} from '../HTTPError' import {HTTPError} from '../HTTPError'
import {ActivatedRoute} from '../routing/ActivatedRoute'
/** /**
* Enumeration of different HTTP verbs. * Enumeration of different HTTP verbs.
@ -177,20 +178,25 @@ export class Request extends ScopedContainer implements DataContainer {
* @param key * @param key
*/ */
public input(key?: string): unknown { public input(key?: string): unknown {
if ( !key ) { let sources = {
return { ...this.parsedInput,
...this.parsedInput, ...this.query,
...this.query, ...this.uploadedFiles,
...this.uploadedFiles, }
if ( this.hasKey(ActivatedRoute) ) {
sources = {
...sources,
...this.make<ActivatedRoute<unknown, unknown[]>>(ActivatedRoute).params,
} }
} }
if ( key in this.parsedInput ) { if ( !key ) {
return this.parsedInput[key] return sources
} }
if ( key in this.query ) { if ( key in sources ) {
return this.query[key] return sources[key]
} }
} }