mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #17354 from mailto1587/master
[hapi] Change the type of Request.query to any instead of Object for buildin…
This commit is contained in:
Vendored
+4
-3
@@ -1935,10 +1935,11 @@ export class Request extends Podium {
|
||||
/** same as pre but represented as the response object created by the pre method. */
|
||||
preResponses: Object;
|
||||
/**
|
||||
* an object containing the query parameters.
|
||||
* TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479
|
||||
* by default the object outputted from [node's URL parse()](https://nodejs.org/docs/latest/api/url.html#url_urlobject_query) method.
|
||||
* Might also be set indirectly via [request.setUrl](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17354#requestseturlurl-striptrailingslash) in which case it may be
|
||||
* a string (if url is set to an object with the query attribute as an unparsed string).
|
||||
*/
|
||||
query: Object;
|
||||
query: any;
|
||||
/** an object containing the Node HTTP server objects. **Direct interaction with these raw objects is not recommended.** */
|
||||
raw: {
|
||||
req: http.IncomingMessage; // Or http.ClientRequest http://www.apetuts.com/tutorial/node-js-http-client-request-class/ ?
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Added test in addition to docs, for request.query
|
||||
|
||||
import * as Hapi from 'hapi';
|
||||
|
||||
interface GetThingQuery {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const handler: Hapi.RouteHandler = function (request, reply) {
|
||||
|
||||
const query = request.query as GetThingQuery;
|
||||
|
||||
return reply(`You asked for ${query.name}`);
|
||||
};
|
||||
@@ -35,6 +35,7 @@
|
||||
"test/request/generate-response.ts",
|
||||
"test/request/get-log.ts",
|
||||
"test/request/log.ts",
|
||||
"test/request/query.ts",
|
||||
"test/request/set-method.ts",
|
||||
"test/request/set-url.ts",
|
||||
"test/request/tail.ts",
|
||||
|
||||
Reference in New Issue
Block a user