I have been using LB4 since July, and until recently I've been able to grab the query parameters from the RestBindings.Http.Request.query using the following injection statement in my controller constructor
@inject(RestBindings.Http.REQUEST) private req: Request,
Followed by this.req.query.<property> somewhere in my code.
This no longer works, even if I create a brand new application using the latest lb4 app and try to expose the query via the default Ping-controller. When trying the following section of code
query: 'Query response: ' + this.req.query.start,
greeting: 'Hello from LoopBack',
date: new Date(),
url: this.req.url,
headers: Object.assign({}, this.req.headers),
using this request localhost:3000/ping?start=2018-08-25&end=2018-09-09&user=larsm
reponse now returns 'undefined' (rather than returning the query parameters):
{
"query": "Query response: undefined",
"greeting": "Hello from LoopBack",
"date": "2018-11-27T23:21:53.142Z",
"url": "/ping?start=2018-08-25&end=2018-09-09&user=larsm",
"headers": {
"host": "localhost:3000",
"connection": "keep-alive",
"cache-control": "max-age=0",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"accept-encoding": "gzip, deflate, br",
"accept-language": "nb-NO,nb;q=0.9,en-GB;q=0.8,en;q=0.7,no;q=0.6,nn;q=0.5,en-US;q=0.4"
}
}
I have been using LB4 since July, and until recently I've been able to grab the query parameters from the RestBindings.Http.Request.query using the following injection statement in my controller constructor
@inject(RestBindings.Http.REQUEST) private req: Request,Followed by
this.req.query.<property>somewhere in my code.This no longer works, even if I create a brand new application using the latest lb4 app and try to expose the query via the default Ping-controller. When trying the following section of code
using this request localhost:3000/ping?start=2018-08-25&end=2018-09-09&user=larsm
reponse now returns 'undefined' (rather than returning the query parameters):