Include request parameters in input(...) sources; bump version
This commit is contained in:
parent
153f8f7685
commit
467721f775
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@extollo/lib",
|
||||
"version": "0.9.5",
|
||||
"version": "0.9.6",
|
||||
"description": "The framework library that lifts up your code.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -7,6 +7,7 @@ import * as url from 'url'
|
||||
import {Response} from './Response'
|
||||
import * as Negotiator from 'negotiator'
|
||||
import {HTTPError} from '../HTTPError'
|
||||
import {ActivatedRoute} from '../routing/ActivatedRoute'
|
||||
|
||||
/**
|
||||
* Enumeration of different HTTP verbs.
|
||||
@ -177,20 +178,25 @@ export class Request extends ScopedContainer implements DataContainer {
|
||||
* @param key
|
||||
*/
|
||||
public input(key?: string): unknown {
|
||||
if ( !key ) {
|
||||
return {
|
||||
...this.parsedInput,
|
||||
...this.query,
|
||||
...this.uploadedFiles,
|
||||
let sources = {
|
||||
...this.parsedInput,
|
||||
...this.query,
|
||||
...this.uploadedFiles,
|
||||
}
|
||||
|
||||
if ( this.hasKey(ActivatedRoute) ) {
|
||||
sources = {
|
||||
...sources,
|
||||
...this.make<ActivatedRoute<unknown, unknown[]>>(ActivatedRoute).params,
|
||||
}
|
||||
}
|
||||
|
||||
if ( key in this.parsedInput ) {
|
||||
return this.parsedInput[key]
|
||||
if ( !key ) {
|
||||
return sources
|
||||
}
|
||||
|
||||
if ( key in this.query ) {
|
||||
return this.query[key]
|
||||
if ( key in sources ) {
|
||||
return sources[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user