@adonisjs/http-server 5.11.0 → 6.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -38
- package/build/index.d.ts +16 -0
- package/build/index.js +16 -0
- package/build/src/cookies/client.d.ts +12 -0
- package/build/src/cookies/client.js +42 -0
- package/build/src/cookies/drivers/encrypted.d.ts +4 -0
- package/build/src/cookies/drivers/encrypted.js +16 -0
- package/build/src/cookies/drivers/plain.d.ts +3 -0
- package/build/src/cookies/drivers/plain.js +13 -0
- package/build/src/cookies/drivers/signed.d.ts +4 -0
- package/build/src/cookies/drivers/signed.js +16 -0
- package/build/src/cookies/parser.d.ts +9 -0
- package/build/src/cookies/parser.js +69 -0
- package/build/src/cookies/serializer.d.ts +11 -0
- package/build/src/cookies/serializer.js +39 -0
- package/build/src/debug.d.ts +3 -0
- package/build/src/debug.js +2 -0
- package/build/src/define_config.d.ts +2 -0
- package/build/src/define_config.js +40 -0
- package/build/src/define_middleware.d.ts +4 -0
- package/build/src/define_middleware.js +6 -0
- package/build/src/exceptions/abort_exception.d.ts +5 -0
- package/build/src/exceptions/abort_exception.js +6 -0
- package/build/src/exceptions/cannot_lookup_route.d.ts +5 -0
- package/build/src/exceptions/cannot_lookup_route.js +5 -0
- package/build/src/exceptions/http_exception.d.ts +6 -0
- package/build/src/exceptions/http_exception.js +20 -0
- package/build/src/exceptions/route_not_found.d.ts +5 -0
- package/build/src/exceptions/route_not_found.js +5 -0
- package/build/src/helpers.d.ts +6 -67
- package/build/src/helpers.js +13 -168
- package/build/src/http_context/local_storage.d.ts +9 -0
- package/build/src/http_context/local_storage.js +14 -0
- package/build/src/http_context/main.d.ts +20 -0
- package/build/src/http_context/main.js +49 -0
- package/build/src/middleware/store.d.ts +11 -0
- package/build/src/middleware/store.js +33 -0
- package/build/src/qs.d.ts +7 -0
- package/build/src/qs.js +13 -0
- package/build/src/redirect.d.ts +18 -0
- package/build/src/redirect.js +80 -0
- package/build/src/request.d.ts +81 -0
- package/build/src/request.js +315 -0
- package/build/src/response.d.ts +108 -0
- package/build/src/response.js +587 -0
- package/build/src/router/brisk.d.ts +18 -0
- package/build/src/router/brisk.js +35 -0
- package/build/src/router/executor.d.ts +4 -0
- package/build/src/router/executor.js +16 -0
- package/build/src/router/group.d.ts +19 -0
- package/build/src/router/group.js +117 -0
- package/build/src/router/lookup_store/main.d.ts +17 -0
- package/build/src/router/lookup_store/main.js +37 -0
- package/build/src/router/lookup_store/route_finder.d.ts +8 -0
- package/build/src/router/lookup_store/route_finder.js +28 -0
- package/build/src/router/lookup_store/url_builder.d.ts +16 -0
- package/build/src/router/lookup_store/url_builder.js +111 -0
- package/build/src/router/main.d.ts +36 -0
- package/build/src/router/main.js +161 -0
- package/build/src/router/matchers.d.ts +14 -0
- package/build/src/router/matchers.js +15 -0
- package/build/src/router/resource.d.ts +27 -0
- package/build/src/router/resource.js +124 -0
- package/build/src/router/route.d.ts +28 -0
- package/build/src/router/route.js +135 -0
- package/build/src/router/store.d.ts +12 -0
- package/build/src/router/store.js +87 -0
- package/build/src/server/factories/final_handler.d.ts +4 -0
- package/build/src/server/factories/final_handler.js +17 -0
- package/build/src/server/factories/middleware_handler.d.ts +5 -0
- package/build/src/server/factories/middleware_handler.js +5 -0
- package/build/src/server/factories/use_return_value.d.ts +2 -0
- package/build/src/server/factories/use_return_value.js +9 -0
- package/build/src/server/factories/write_response.d.ts +2 -0
- package/build/src/server/factories/write_response.js +12 -0
- package/build/src/server/main.d.ts +23 -0
- package/build/src/server/main.js +124 -0
- package/build/src/types/base.d.ts +5 -0
- package/build/src/types/base.js +1 -0
- package/build/src/types/middleware.d.ts +14 -0
- package/build/src/types/middleware.js +1 -0
- package/build/src/types/qs.d.ts +15 -0
- package/build/src/types/qs.js +1 -0
- package/build/src/types/request.d.ts +7 -0
- package/build/src/types/request.js +1 -0
- package/build/src/types/response.d.ts +18 -0
- package/build/src/types/response.js +1 -0
- package/build/src/types/route.d.ts +74 -0
- package/build/src/types/route.js +1 -0
- package/build/src/types/server.d.ts +13 -0
- package/build/src/types/server.js +1 -0
- package/package.json +98 -96
- package/build/adonis-typings/container.d.ts +0 -24
- package/build/adonis-typings/container.js +0 -8
- package/build/adonis-typings/context.d.ts +0 -73
- package/build/adonis-typings/context.js +0 -8
- package/build/adonis-typings/cookie-client.d.ts +0 -34
- package/build/adonis-typings/cookie-client.js +0 -8
- package/build/adonis-typings/http-server.d.ts +0 -98
- package/build/adonis-typings/http-server.js +0 -8
- package/build/adonis-typings/index.d.ts +0 -16
- package/build/adonis-typings/index.js +0 -16
- package/build/adonis-typings/middleware.d.ts +0 -95
- package/build/adonis-typings/middleware.js +0 -8
- package/build/adonis-typings/request.d.ts +0 -556
- package/build/adonis-typings/request.js +0 -8
- package/build/adonis-typings/response.d.ts +0 -438
- package/build/adonis-typings/response.js +0 -8
- package/build/adonis-typings/route.d.ts +0 -559
- package/build/adonis-typings/route.js +0 -8
- package/build/exceptions.json +0 -110
- package/build/providers/HttpServerProvider.d.ts +0 -46
- package/build/providers/HttpServerProvider.js +0 -100
- package/build/src/Cookie/Client/index.d.ts +0 -39
- package/build/src/Cookie/Client/index.js +0 -108
- package/build/src/Cookie/Drivers/Encrypted.d.ts +0 -24
- package/build/src/Cookie/Drivers/Encrypted.js +0 -42
- package/build/src/Cookie/Drivers/Plain.d.ts +0 -23
- package/build/src/Cookie/Drivers/Plain.js +0 -40
- package/build/src/Cookie/Drivers/Signed.d.ts +0 -24
- package/build/src/Cookie/Drivers/Signed.js +0 -42
- package/build/src/Cookie/Parser/index.d.ts +0 -61
- package/build/src/Cookie/Parser/index.js +0 -174
- package/build/src/Cookie/Serializer/index.d.ts +0 -44
- package/build/src/Cookie/Serializer/index.js +0 -88
- package/build/src/Exceptions/HttpException.d.ts +0 -20
- package/build/src/Exceptions/HttpException.js +0 -36
- package/build/src/Exceptions/RouterException.d.ts +0 -36
- package/build/src/Exceptions/RouterException.js +0 -76
- package/build/src/HttpContext/LocalStorage/index.d.ts +0 -24
- package/build/src/HttpContext/LocalStorage/index.js +0 -28
- package/build/src/HttpContext/index.d.ts +0 -90
- package/build/src/HttpContext/index.js +0 -181
- package/build/src/MiddlewareStore/index.d.ts +0 -92
- package/build/src/MiddlewareStore/index.js +0 -133
- package/build/src/Redirect/index.d.ts +0 -71
- package/build/src/Redirect/index.js +0 -139
- package/build/src/Request/index.d.ts +0 -619
- package/build/src/Request/index.js +0 -862
- package/build/src/Response/index.d.ts +0 -412
- package/build/src/Response/index.js +0 -1010
- package/build/src/Router/BriskRoute.d.ts +0 -53
- package/build/src/Router/BriskRoute.js +0 -74
- package/build/src/Router/Group.d.ts +0 -101
- package/build/src/Router/Group.js +0 -165
- package/build/src/Router/LookupStore.d.ts +0 -122
- package/build/src/Router/LookupStore.js +0 -264
- package/build/src/Router/Matchers.d.ts +0 -31
- package/build/src/Router/Matchers.js +0 -43
- package/build/src/Router/Resource.d.ts +0 -95
- package/build/src/Router/Resource.js +0 -182
- package/build/src/Router/Route.d.ts +0 -138
- package/build/src/Router/Route.js +0 -204
- package/build/src/Router/Store.d.ts +0 -93
- package/build/src/Router/Store.js +0 -211
- package/build/src/Router/index.d.ts +0 -142
- package/build/src/Router/index.js +0 -333
- package/build/src/Server/ExceptionManager/index.d.ts +0 -49
- package/build/src/Server/ExceptionManager/index.js +0 -96
- package/build/src/Server/Hooks/index.d.ts +0 -43
- package/build/src/Server/Hooks/index.js +0 -77
- package/build/src/Server/PreCompiler/index.d.ts +0 -60
- package/build/src/Server/PreCompiler/index.js +0 -141
- package/build/src/Server/RequestHandler/index.d.ts +0 -39
- package/build/src/Server/RequestHandler/index.js +0 -87
- package/build/src/Server/index.d.ts +0 -90
- package/build/src/Server/index.js +0 -175
- package/build/standalone.d.ts +0 -14
- package/build/standalone.js +0 -23
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
/// <reference types="node" />
|
|
10
|
-
/// <reference types="node" />
|
|
11
|
-
/// <reference types="node" />
|
|
12
|
-
declare module '@ioc:Adonis/Core/Response' {
|
|
13
|
-
import { ServerResponse, IncomingMessage } from 'http';
|
|
14
|
-
import { MacroableConstructorContract } from 'macroable';
|
|
15
|
-
import { EncryptionContract } from '@ioc:Adonis/Core/Encryption';
|
|
16
|
-
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
17
|
-
import { MakeUrlOptions, RouterContract } from '@ioc:Adonis/Core/Route';
|
|
18
|
-
/**
|
|
19
|
-
* Cookie options can that can be set on the response
|
|
20
|
-
*/
|
|
21
|
-
export type CookieOptions = {
|
|
22
|
-
domain: string;
|
|
23
|
-
expires: Date | (() => Date);
|
|
24
|
-
httpOnly: boolean;
|
|
25
|
-
maxAge: number | string;
|
|
26
|
-
path: string;
|
|
27
|
-
sameSite: boolean | 'lax' | 'none' | 'strict';
|
|
28
|
-
secure: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Types from which response header can be casted to a
|
|
32
|
-
* string
|
|
33
|
-
*/
|
|
34
|
-
export type CastableHeader = string | number | boolean | string[] | number[] | boolean[];
|
|
35
|
-
/**
|
|
36
|
-
* Types of readable stream allowed for HTTP response
|
|
37
|
-
*/
|
|
38
|
-
export type ResponseStream = NodeJS.ReadStream | NodeJS.ReadWriteStream | NodeJS.ReadableStream;
|
|
39
|
-
/**
|
|
40
|
-
* Main response interface
|
|
41
|
-
*/
|
|
42
|
-
export interface ResponseContract {
|
|
43
|
-
/**
|
|
44
|
-
* Returns a boolean telling if lazy body is already set or not
|
|
45
|
-
*/
|
|
46
|
-
hasLazyBody: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Lazy body is used to set the response body. However, do not
|
|
49
|
-
* write it on the socket immediately unless `response.finish`
|
|
50
|
-
* is called.
|
|
51
|
-
*
|
|
52
|
-
* Only works with `explicitEnd=true`, which is set to `false` by default
|
|
53
|
-
*/
|
|
54
|
-
lazyBody: any[];
|
|
55
|
-
/**
|
|
56
|
-
* Returns a boolean telling if response is finished or not.
|
|
57
|
-
* Any more attempts to update headers or body will result
|
|
58
|
-
* in raised exceptions.
|
|
59
|
-
*/
|
|
60
|
-
finished: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Returns a boolean telling if response headers has been sent or not.
|
|
63
|
-
* Any more attempts to update headers will result in raised
|
|
64
|
-
* exceptions.
|
|
65
|
-
*/
|
|
66
|
-
headersSent: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Returns a boolean telling if response headers and body is written
|
|
69
|
-
* or not. When value is `true`, you can feel free to write headers
|
|
70
|
-
* and body.
|
|
71
|
-
*/
|
|
72
|
-
isPending: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Find if the response body is a stream. Returns false when
|
|
75
|
-
* no body is defined yet
|
|
76
|
-
*/
|
|
77
|
-
isStreamResponse: boolean;
|
|
78
|
-
request: IncomingMessage;
|
|
79
|
-
response: ServerResponse;
|
|
80
|
-
/**
|
|
81
|
-
* The ctx will be set by the context itself. It creates a circular
|
|
82
|
-
* reference
|
|
83
|
-
*/
|
|
84
|
-
ctx?: HttpContextContract;
|
|
85
|
-
/**
|
|
86
|
-
* Writes headers to the response.
|
|
87
|
-
*/
|
|
88
|
-
flushHeaders(statusCode?: number): this;
|
|
89
|
-
/**
|
|
90
|
-
* Returns the existing value for a given HTTP response
|
|
91
|
-
* header.
|
|
92
|
-
*/
|
|
93
|
-
getHeader(key: string): string | string[] | number | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Get headers
|
|
96
|
-
*/
|
|
97
|
-
getHeaders(): {
|
|
98
|
-
[key: string]: string | string[] | number;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Set header on the response. To `append` values to the existing header, we suggest
|
|
102
|
-
* using [[append]] method.
|
|
103
|
-
*
|
|
104
|
-
* If `value` is non existy, then header won't be set.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```js
|
|
108
|
-
* response.header('content-type', 'application/json')
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
header(key: string, value: CastableHeader): this;
|
|
112
|
-
/**
|
|
113
|
-
* Append value to an existing header. To replace the value, we suggest using
|
|
114
|
-
* [[header]] method.
|
|
115
|
-
*
|
|
116
|
-
* If `value` is not existy, then header won't be set.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```js
|
|
120
|
-
* response.append('set-cookie', 'username=virk')
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
append(key: string, value: CastableHeader): this;
|
|
124
|
-
/**
|
|
125
|
-
* Adds HTTP response header, when it doesn't exists already.
|
|
126
|
-
*/
|
|
127
|
-
safeHeader(key: string, value: CastableHeader): this;
|
|
128
|
-
/**
|
|
129
|
-
* Removes the existing response header from being sent.
|
|
130
|
-
*/
|
|
131
|
-
removeHeader(key: string): this;
|
|
132
|
-
/**
|
|
133
|
-
* Get the current status for the response
|
|
134
|
-
*/
|
|
135
|
-
getStatus(): number;
|
|
136
|
-
/**
|
|
137
|
-
* Set HTTP status code
|
|
138
|
-
*/
|
|
139
|
-
status(code: number): this;
|
|
140
|
-
/**
|
|
141
|
-
* Set's status code only when it's not explictly
|
|
142
|
-
* set
|
|
143
|
-
*/
|
|
144
|
-
safeStatus(code: number): this;
|
|
145
|
-
/**
|
|
146
|
-
* Set response type by looking up for the mime-type using
|
|
147
|
-
* partial types like file extensions.
|
|
148
|
-
*
|
|
149
|
-
* Make sure to read [mime-types](https://www.npmjs.com/package/mime-types) docs
|
|
150
|
-
* too.
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```js
|
|
154
|
-
* response.type('.json') // Content-type: application/json
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
type(type: string, charset?: string): this;
|
|
158
|
-
/**
|
|
159
|
-
* Set the Vary HTTP header
|
|
160
|
-
*/
|
|
161
|
-
vary(field: string | string[]): this;
|
|
162
|
-
/**
|
|
163
|
-
* Set etag by computing hash from the body. This class will set the etag automatically
|
|
164
|
-
* when `etag = true` in the defined config object.
|
|
165
|
-
*
|
|
166
|
-
* Use this function, when you want to compute etag manually for some other resons.
|
|
167
|
-
*/
|
|
168
|
-
setEtag(body: any, weak?: boolean): this;
|
|
169
|
-
/**
|
|
170
|
-
* Returns a boolean telling if the new response etag evaluates same
|
|
171
|
-
* as the request header `if-none-match`. In case of `true`, the
|
|
172
|
-
* server must return `304` response, telling the browser to
|
|
173
|
-
* use the client cache.
|
|
174
|
-
*
|
|
175
|
-
* You won't have to deal with this method directly, since AdonisJs will
|
|
176
|
-
* handle this for you when `http.etag = true` inside `config/app.js` file.
|
|
177
|
-
*
|
|
178
|
-
* However, this is how you can use it manually.
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```js
|
|
182
|
-
* const responseBody = view.render('some-view')
|
|
183
|
-
*
|
|
184
|
-
* // sets the HTTP etag header for response
|
|
185
|
-
* response.setEtag(responseBody)
|
|
186
|
-
*
|
|
187
|
-
* if (response.fresh()) {
|
|
188
|
-
* response.sendStatus(304)
|
|
189
|
-
* } else {
|
|
190
|
-
* response.send(responseBody)
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
fresh(): boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Get body for the response. Returns null when body is
|
|
197
|
-
* a stream
|
|
198
|
-
*/
|
|
199
|
-
getBody(): any;
|
|
200
|
-
/**
|
|
201
|
-
* Send the body as response and optionally generate etag. The default value
|
|
202
|
-
* is read from `config/app.js` file, using `http.etag` property.
|
|
203
|
-
*
|
|
204
|
-
* This method buffers the body if `explicitEnd = true`, which is the default
|
|
205
|
-
* behavior and do not change, unless you know what you are doing.
|
|
206
|
-
*/
|
|
207
|
-
send(body: any, generateEtag?: boolean): void;
|
|
208
|
-
/**
|
|
209
|
-
* Alias of [[send]]
|
|
210
|
-
*/
|
|
211
|
-
json(body: any, generateEtag?: boolean): void;
|
|
212
|
-
/**
|
|
213
|
-
* Writes response as JSONP. The callback name is resolved as follows, with priority
|
|
214
|
-
* from top to bottom.
|
|
215
|
-
*
|
|
216
|
-
* 1. Explicitly defined as 2nd Param.
|
|
217
|
-
* 2. Fetch from request query string.
|
|
218
|
-
* 3. Use the config value `http.jsonpCallbackName` from `config/app.js`.
|
|
219
|
-
* 4. Fallback to `callback`.
|
|
220
|
-
*
|
|
221
|
-
* This method buffers the body if `explicitEnd = true`, which is the default
|
|
222
|
-
* behavior and do not change, unless you know what you are doing.
|
|
223
|
-
*/
|
|
224
|
-
jsonp(body: any, callbackName?: string, generateEtag?: boolean): void;
|
|
225
|
-
/**
|
|
226
|
-
* Pipe stream to the response. This method will gracefully destroy
|
|
227
|
-
* the stream, avoiding memory leaks.
|
|
228
|
-
*
|
|
229
|
-
* If `raiseErrors=false`, then this method will self handle all the exceptions by
|
|
230
|
-
* writing a generic HTTP response. To have more control over the error, it is
|
|
231
|
-
* recommended to set `raiseErrors=true` and wrap this function inside a
|
|
232
|
-
* `try/catch` statement.
|
|
233
|
-
*
|
|
234
|
-
* Streaming a file from the disk and showing 404 when file is missing.
|
|
235
|
-
*
|
|
236
|
-
* @example
|
|
237
|
-
* ```js
|
|
238
|
-
* // Errors handled automatically with generic HTTP response
|
|
239
|
-
* response.stream(fs.createReadStream('file.txt'))
|
|
240
|
-
*
|
|
241
|
-
* // Manually handle (note the await call)
|
|
242
|
-
* try {
|
|
243
|
-
* await response.stream(fs.createReadStream('file.txt'))
|
|
244
|
-
* } catch () {
|
|
245
|
-
* response.status(404).send('File not found')
|
|
246
|
-
* }
|
|
247
|
-
* ```
|
|
248
|
-
*/
|
|
249
|
-
stream(stream: ResponseStream, errorCallback?: (error: NodeJS.ErrnoException) => any): void;
|
|
250
|
-
/**
|
|
251
|
-
* Download file by streaming it from the file path. This method will setup
|
|
252
|
-
* appropriate `Content-type`, `Content-type` and `Last-modified` headers.
|
|
253
|
-
*
|
|
254
|
-
* Unexpected stream errors are handled gracefully to avoid memory leaks.
|
|
255
|
-
*
|
|
256
|
-
* If `raiseErrors=false`, then this method will self handle all the exceptions by
|
|
257
|
-
* writing a generic HTTP response. To have more control over the error, it is
|
|
258
|
-
* recommended to set `raiseErrors=true` and wrap this function inside a
|
|
259
|
-
* `try/catch` statement.
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* ```js
|
|
263
|
-
* // Errors handled automatically with generic HTTP response
|
|
264
|
-
* response.download('somefile.jpg')
|
|
265
|
-
*
|
|
266
|
-
* // Manually handle (note the await call)
|
|
267
|
-
* try {
|
|
268
|
-
* await response.download('somefile.jpg')
|
|
269
|
-
* } catch (error) {
|
|
270
|
-
* response.status(error.code === 'ENOENT' ? 404 : 500)
|
|
271
|
-
* response.send('Cannot process file')
|
|
272
|
-
* }
|
|
273
|
-
* ```
|
|
274
|
-
*/
|
|
275
|
-
download(filePath: string, generateEtag?: boolean, errorCallback?: (error: NodeJS.ErrnoException) => any): void;
|
|
276
|
-
/**
|
|
277
|
-
* Download the file by forcing the user to save the file vs displaying it
|
|
278
|
-
* within the browser.
|
|
279
|
-
*
|
|
280
|
-
* Internally calls [[download]]
|
|
281
|
-
*/
|
|
282
|
-
attachment(filePath: string, name?: string, disposition?: string, generateEtag?: boolean, errorCallback?: (error: NodeJS.ErrnoException) => any): void;
|
|
283
|
-
/**
|
|
284
|
-
* Set the location header.
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```js
|
|
288
|
-
* response.location('/login')
|
|
289
|
-
* ```
|
|
290
|
-
*/
|
|
291
|
-
location(url: string): this;
|
|
292
|
-
/**
|
|
293
|
-
* Redirect the request.
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* ```js
|
|
297
|
-
* response.redirect('/foo')
|
|
298
|
-
* response.redirect().toRoute('foo.bar')
|
|
299
|
-
* response.redirect().back()
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
redirect(): RedirectContract;
|
|
303
|
-
redirect(path: string, forwardQueryString?: boolean, statusCode?: number): void;
|
|
304
|
-
/**
|
|
305
|
-
* Set signed cookie as the response header. The inline options overrides
|
|
306
|
-
* all options from the config (means they are not merged).
|
|
307
|
-
*/
|
|
308
|
-
cookie(key: string, value: any, options?: Partial<CookieOptions>): this;
|
|
309
|
-
/**
|
|
310
|
-
* Set unsigned cookie as the response header. The inline options overrides
|
|
311
|
-
* all options from the config (means they are not merged)
|
|
312
|
-
*/
|
|
313
|
-
plainCookie(key: string, value: any, options?: Partial<CookieOptions>): this;
|
|
314
|
-
/**
|
|
315
|
-
* Set unsigned cookie as the response header. The inline options overrides
|
|
316
|
-
* all options from the config (means they are not merged)
|
|
317
|
-
*/
|
|
318
|
-
encryptedCookie(key: string, value: any, options?: Partial<CookieOptions>): this;
|
|
319
|
-
/**
|
|
320
|
-
* Clear existing cookie.
|
|
321
|
-
*/
|
|
322
|
-
clearCookie(key: string): this;
|
|
323
|
-
/**
|
|
324
|
-
* Abort the request with custom body and a status code. 400 is
|
|
325
|
-
* used when status is not defined
|
|
326
|
-
*/
|
|
327
|
-
abort(body: any, status?: number): never;
|
|
328
|
-
/**
|
|
329
|
-
* Abort the request with custom body and a status code when
|
|
330
|
-
* passed condition returns `true`
|
|
331
|
-
*/
|
|
332
|
-
abortIf(conditional: any, body: any, status?: number): void;
|
|
333
|
-
/**
|
|
334
|
-
* Abort the request with custom body and a status code when
|
|
335
|
-
* passed condition returns `false`
|
|
336
|
-
*/
|
|
337
|
-
abortUnless(conditional: any, body: any, status?: number): void;
|
|
338
|
-
/**
|
|
339
|
-
* Finishes the response by writing the lazy body, when `explicitEnd = true`
|
|
340
|
-
* and response is already pending.
|
|
341
|
-
*
|
|
342
|
-
* Calling this method twice or when `explicitEnd = false` is noop.
|
|
343
|
-
*/
|
|
344
|
-
finish(): void;
|
|
345
|
-
continue(): void;
|
|
346
|
-
switchingProtocols(): void;
|
|
347
|
-
ok(body: any, generateEtag?: boolean): void;
|
|
348
|
-
created(body?: any, generateEtag?: boolean): void;
|
|
349
|
-
accepted(body: any, generateEtag?: boolean): void;
|
|
350
|
-
nonAuthoritativeInformation(body: any, generateEtag?: boolean): void;
|
|
351
|
-
noContent(): void;
|
|
352
|
-
resetContent(): void;
|
|
353
|
-
partialContent(body: any, generateEtag?: boolean): void;
|
|
354
|
-
multipleChoices(body?: any, generateEtag?: boolean): void;
|
|
355
|
-
movedPermanently(body?: any, generateEtag?: boolean): void;
|
|
356
|
-
movedTemporarily(body?: any, generateEtag?: boolean): void;
|
|
357
|
-
seeOther(body?: any, generateEtag?: boolean): void;
|
|
358
|
-
notModified(body?: any, generateEtag?: boolean): void;
|
|
359
|
-
useProxy(body?: any, generateEtag?: boolean): void;
|
|
360
|
-
temporaryRedirect(body?: any, generateEtag?: boolean): void;
|
|
361
|
-
badRequest(body?: any, generateEtag?: boolean): void;
|
|
362
|
-
unauthorized(body?: any, generateEtag?: boolean): void;
|
|
363
|
-
paymentRequired(body?: any, generateEtag?: boolean): void;
|
|
364
|
-
forbidden(body?: any, generateEtag?: boolean): void;
|
|
365
|
-
notFound(body?: any, generateEtag?: boolean): void;
|
|
366
|
-
methodNotAllowed(body?: any, generateEtag?: boolean): void;
|
|
367
|
-
notAcceptable(body?: any, generateEtag?: boolean): void;
|
|
368
|
-
proxyAuthenticationRequired(body?: any, generateEtag?: boolean): void;
|
|
369
|
-
requestTimeout(body?: any, generateEtag?: boolean): void;
|
|
370
|
-
conflict(body?: any, generateEtag?: boolean): void;
|
|
371
|
-
gone(body?: any, generateEtag?: boolean): void;
|
|
372
|
-
lengthRequired(body?: any, generateEtag?: boolean): void;
|
|
373
|
-
preconditionFailed(body?: any, generateEtag?: boolean): void;
|
|
374
|
-
requestEntityTooLarge(body?: any, generateEtag?: boolean): void;
|
|
375
|
-
requestUriTooLong(body?: any, generateEtag?: boolean): void;
|
|
376
|
-
unsupportedMediaType(body?: any, generateEtag?: boolean): void;
|
|
377
|
-
requestedRangeNotSatisfiable(body?: any, generateEtag?: boolean): void;
|
|
378
|
-
expectationFailed(body?: any, generateEtag?: boolean): void;
|
|
379
|
-
unprocessableEntity(body?: any, generateEtag?: boolean): void;
|
|
380
|
-
tooManyRequests(body?: any, generateEtag?: boolean): void;
|
|
381
|
-
internalServerError(body?: any, generateEtag?: boolean): void;
|
|
382
|
-
notImplemented(body?: any, generateEtag?: boolean): void;
|
|
383
|
-
badGateway(body?: any, generateEtag?: boolean): void;
|
|
384
|
-
serviceUnavailable(body?: any, generateEtag?: boolean): void;
|
|
385
|
-
gatewayTimeout(body?: any, generateEtag?: boolean): void;
|
|
386
|
-
httpVersionNotSupported(body?: any, generateEtag?: boolean): void;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Redirect interface
|
|
390
|
-
*/
|
|
391
|
-
export interface RedirectContract {
|
|
392
|
-
/**
|
|
393
|
-
* Set a custom status code.
|
|
394
|
-
*/
|
|
395
|
-
status(statusCode: number): this;
|
|
396
|
-
/**
|
|
397
|
-
* Clear existing query string values added using
|
|
398
|
-
* "withQs"
|
|
399
|
-
*/
|
|
400
|
-
clearQs(): this;
|
|
401
|
-
/**
|
|
402
|
-
* Forward the current QueryString or define one.
|
|
403
|
-
*/
|
|
404
|
-
withQs(): this;
|
|
405
|
-
withQs(values: Record<string, any>): this;
|
|
406
|
-
withQs(name: string, value: any): this;
|
|
407
|
-
/**
|
|
408
|
-
* Redirect to the previous path.
|
|
409
|
-
*/
|
|
410
|
-
back(): void;
|
|
411
|
-
/**
|
|
412
|
-
* Redirect the request using a route identifier.
|
|
413
|
-
*/
|
|
414
|
-
toRoute(routeIdentifier: string, params?: any[] | MakeUrlOptions, options?: MakeUrlOptions): void;
|
|
415
|
-
/**
|
|
416
|
-
* Redirect the request using a path.
|
|
417
|
-
*/
|
|
418
|
-
toPath(url: string): void;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Config accepted by response the class
|
|
422
|
-
*/
|
|
423
|
-
export type ResponseConfig = {
|
|
424
|
-
etag: boolean;
|
|
425
|
-
jsonpCallbackName: string;
|
|
426
|
-
cookie: Partial<CookieOptions>;
|
|
427
|
-
};
|
|
428
|
-
/**
|
|
429
|
-
* Shape of response constructor, we export the constructor for others to
|
|
430
|
-
* add macros to the request class. Since, the instance is passed
|
|
431
|
-
* to the http request cycle
|
|
432
|
-
*/
|
|
433
|
-
export interface ResponseConstructorContract extends MacroableConstructorContract<ResponseContract> {
|
|
434
|
-
new (request: IncomingMessage, response: ServerResponse, encryption: EncryptionContract, config: ResponseConfig, router: RouterContract): ResponseContract;
|
|
435
|
-
}
|
|
436
|
-
const Response: ResponseConstructorContract;
|
|
437
|
-
export default Response;
|
|
438
|
-
}
|