@adonisjs/http-server 5.12.0 → 6.0.1-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.
Files changed (171) hide show
  1. package/README.md +15 -38
  2. package/build/index.d.ts +16 -0
  3. package/build/index.js +16 -0
  4. package/build/src/cookies/client.d.ts +12 -0
  5. package/build/src/cookies/client.js +42 -0
  6. package/build/src/cookies/drivers/encrypted.d.ts +4 -0
  7. package/build/src/cookies/drivers/encrypted.js +16 -0
  8. package/build/src/cookies/drivers/plain.d.ts +3 -0
  9. package/build/src/cookies/drivers/plain.js +13 -0
  10. package/build/src/cookies/drivers/signed.d.ts +4 -0
  11. package/build/src/cookies/drivers/signed.js +16 -0
  12. package/build/src/cookies/parser.d.ts +9 -0
  13. package/build/src/cookies/parser.js +69 -0
  14. package/build/src/cookies/serializer.d.ts +11 -0
  15. package/build/src/cookies/serializer.js +39 -0
  16. package/build/src/debug.d.ts +3 -0
  17. package/build/src/debug.js +2 -0
  18. package/build/src/define_config.d.ts +2 -0
  19. package/build/src/define_config.js +40 -0
  20. package/build/src/define_middleware.d.ts +4 -0
  21. package/build/src/define_middleware.js +6 -0
  22. package/build/src/exceptions/abort_exception.d.ts +5 -0
  23. package/build/src/exceptions/abort_exception.js +6 -0
  24. package/build/src/exceptions/cannot_lookup_route.d.ts +5 -0
  25. package/build/src/exceptions/cannot_lookup_route.js +5 -0
  26. package/build/src/exceptions/http_exception.d.ts +6 -0
  27. package/build/src/exceptions/http_exception.js +20 -0
  28. package/build/src/exceptions/route_not_found.d.ts +5 -0
  29. package/build/src/exceptions/route_not_found.js +5 -0
  30. package/build/src/helpers.d.ts +6 -67
  31. package/build/src/helpers.js +13 -168
  32. package/build/src/http_context/local_storage.d.ts +9 -0
  33. package/build/src/http_context/local_storage.js +14 -0
  34. package/build/src/http_context/main.d.ts +20 -0
  35. package/build/src/http_context/main.js +49 -0
  36. package/build/src/middleware/store.d.ts +11 -0
  37. package/build/src/middleware/store.js +33 -0
  38. package/build/src/qs.d.ts +7 -0
  39. package/build/src/qs.js +13 -0
  40. package/build/src/redirect.d.ts +18 -0
  41. package/build/src/redirect.js +80 -0
  42. package/build/src/request.d.ts +81 -0
  43. package/build/src/request.js +315 -0
  44. package/build/src/response.d.ts +108 -0
  45. package/build/src/response.js +587 -0
  46. package/build/src/router/brisk.d.ts +18 -0
  47. package/build/src/router/brisk.js +35 -0
  48. package/build/src/router/executor.d.ts +4 -0
  49. package/build/src/router/executor.js +16 -0
  50. package/build/src/router/group.d.ts +19 -0
  51. package/build/src/router/group.js +117 -0
  52. package/build/src/router/lookup_store/main.d.ts +17 -0
  53. package/build/src/router/lookup_store/main.js +37 -0
  54. package/build/src/router/lookup_store/route_finder.d.ts +8 -0
  55. package/build/src/router/lookup_store/route_finder.js +28 -0
  56. package/build/src/router/lookup_store/url_builder.d.ts +16 -0
  57. package/build/src/router/lookup_store/url_builder.js +111 -0
  58. package/build/src/router/main.d.ts +36 -0
  59. package/build/src/router/main.js +161 -0
  60. package/build/src/router/matchers.d.ts +14 -0
  61. package/build/src/router/matchers.js +15 -0
  62. package/build/src/router/resource.d.ts +27 -0
  63. package/build/src/router/resource.js +124 -0
  64. package/build/src/router/route.d.ts +28 -0
  65. package/build/src/router/route.js +135 -0
  66. package/build/src/router/store.d.ts +12 -0
  67. package/build/src/router/store.js +87 -0
  68. package/build/src/server/factories/final_handler.d.ts +4 -0
  69. package/build/src/server/factories/final_handler.js +17 -0
  70. package/build/src/server/factories/middleware_handler.d.ts +5 -0
  71. package/build/src/server/factories/middleware_handler.js +5 -0
  72. package/build/src/server/factories/use_return_value.d.ts +2 -0
  73. package/build/src/server/factories/use_return_value.js +9 -0
  74. package/build/src/server/factories/write_response.d.ts +2 -0
  75. package/build/src/server/factories/write_response.js +12 -0
  76. package/build/src/server/main.d.ts +23 -0
  77. package/build/src/server/main.js +124 -0
  78. package/build/src/types/base.d.ts +5 -0
  79. package/build/src/types/base.js +1 -0
  80. package/build/src/types/main.d.ts +7 -0
  81. package/build/src/types/main.js +7 -0
  82. package/build/src/types/middleware.d.ts +14 -0
  83. package/build/src/types/middleware.js +1 -0
  84. package/build/src/types/qs.d.ts +15 -0
  85. package/build/src/types/qs.js +1 -0
  86. package/build/src/types/request.d.ts +7 -0
  87. package/build/src/types/request.js +1 -0
  88. package/build/src/types/response.d.ts +18 -0
  89. package/build/src/types/response.js +1 -0
  90. package/build/src/types/route.d.ts +74 -0
  91. package/build/src/types/route.js +1 -0
  92. package/build/src/types/server.d.ts +13 -0
  93. package/build/src/types/server.js +1 -0
  94. package/package.json +88 -86
  95. package/build/adonis-typings/container.d.ts +0 -24
  96. package/build/adonis-typings/container.js +0 -8
  97. package/build/adonis-typings/context.d.ts +0 -73
  98. package/build/adonis-typings/context.js +0 -8
  99. package/build/adonis-typings/cookie-client.d.ts +0 -34
  100. package/build/adonis-typings/cookie-client.js +0 -8
  101. package/build/adonis-typings/http-server.d.ts +0 -98
  102. package/build/adonis-typings/http-server.js +0 -8
  103. package/build/adonis-typings/index.d.ts +0 -16
  104. package/build/adonis-typings/index.js +0 -16
  105. package/build/adonis-typings/middleware.d.ts +0 -95
  106. package/build/adonis-typings/middleware.js +0 -8
  107. package/build/adonis-typings/request.d.ts +0 -556
  108. package/build/adonis-typings/request.js +0 -8
  109. package/build/adonis-typings/response.d.ts +0 -440
  110. package/build/adonis-typings/response.js +0 -8
  111. package/build/adonis-typings/route.d.ts +0 -559
  112. package/build/adonis-typings/route.js +0 -8
  113. package/build/exceptions.json +0 -110
  114. package/build/providers/HttpServerProvider.d.ts +0 -46
  115. package/build/providers/HttpServerProvider.js +0 -100
  116. package/build/src/Cookie/Client/index.d.ts +0 -39
  117. package/build/src/Cookie/Client/index.js +0 -108
  118. package/build/src/Cookie/Drivers/Encrypted.d.ts +0 -24
  119. package/build/src/Cookie/Drivers/Encrypted.js +0 -42
  120. package/build/src/Cookie/Drivers/Plain.d.ts +0 -23
  121. package/build/src/Cookie/Drivers/Plain.js +0 -40
  122. package/build/src/Cookie/Drivers/Signed.d.ts +0 -24
  123. package/build/src/Cookie/Drivers/Signed.js +0 -42
  124. package/build/src/Cookie/Parser/index.d.ts +0 -61
  125. package/build/src/Cookie/Parser/index.js +0 -174
  126. package/build/src/Cookie/Serializer/index.d.ts +0 -46
  127. package/build/src/Cookie/Serializer/index.js +0 -88
  128. package/build/src/Exceptions/HttpException.d.ts +0 -20
  129. package/build/src/Exceptions/HttpException.js +0 -36
  130. package/build/src/Exceptions/RouterException.d.ts +0 -36
  131. package/build/src/Exceptions/RouterException.js +0 -76
  132. package/build/src/HttpContext/LocalStorage/index.d.ts +0 -24
  133. package/build/src/HttpContext/LocalStorage/index.js +0 -28
  134. package/build/src/HttpContext/index.d.ts +0 -90
  135. package/build/src/HttpContext/index.js +0 -181
  136. package/build/src/MiddlewareStore/index.d.ts +0 -92
  137. package/build/src/MiddlewareStore/index.js +0 -133
  138. package/build/src/Redirect/index.d.ts +0 -71
  139. package/build/src/Redirect/index.js +0 -139
  140. package/build/src/Request/index.d.ts +0 -619
  141. package/build/src/Request/index.js +0 -862
  142. package/build/src/Response/index.d.ts +0 -414
  143. package/build/src/Response/index.js +0 -1010
  144. package/build/src/Router/BriskRoute.d.ts +0 -53
  145. package/build/src/Router/BriskRoute.js +0 -74
  146. package/build/src/Router/Group.d.ts +0 -101
  147. package/build/src/Router/Group.js +0 -165
  148. package/build/src/Router/LookupStore.d.ts +0 -122
  149. package/build/src/Router/LookupStore.js +0 -264
  150. package/build/src/Router/Matchers.d.ts +0 -31
  151. package/build/src/Router/Matchers.js +0 -43
  152. package/build/src/Router/Resource.d.ts +0 -95
  153. package/build/src/Router/Resource.js +0 -182
  154. package/build/src/Router/Route.d.ts +0 -138
  155. package/build/src/Router/Route.js +0 -204
  156. package/build/src/Router/Store.d.ts +0 -93
  157. package/build/src/Router/Store.js +0 -211
  158. package/build/src/Router/index.d.ts +0 -142
  159. package/build/src/Router/index.js +0 -333
  160. package/build/src/Server/ExceptionManager/index.d.ts +0 -49
  161. package/build/src/Server/ExceptionManager/index.js +0 -96
  162. package/build/src/Server/Hooks/index.d.ts +0 -43
  163. package/build/src/Server/Hooks/index.js +0 -77
  164. package/build/src/Server/PreCompiler/index.d.ts +0 -60
  165. package/build/src/Server/PreCompiler/index.js +0 -143
  166. package/build/src/Server/RequestHandler/index.d.ts +0 -39
  167. package/build/src/Server/RequestHandler/index.js +0 -87
  168. package/build/src/Server/index.d.ts +0 -90
  169. package/build/src/Server/index.js +0 -175
  170. package/build/standalone.d.ts +0 -14
  171. package/build/standalone.js +0 -23
@@ -1,440 +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 & {
314
- encoded: boolean;
315
- }>): this;
316
- /**
317
- * Set unsigned cookie as the response header. The inline options overrides
318
- * all options from the config (means they are not merged)
319
- */
320
- encryptedCookie(key: string, value: any, options?: Partial<CookieOptions>): this;
321
- /**
322
- * Clear existing cookie.
323
- */
324
- clearCookie(key: string): this;
325
- /**
326
- * Abort the request with custom body and a status code. 400 is
327
- * used when status is not defined
328
- */
329
- abort(body: any, status?: number): never;
330
- /**
331
- * Abort the request with custom body and a status code when
332
- * passed condition returns `true`
333
- */
334
- abortIf(conditional: any, body: any, status?: number): void;
335
- /**
336
- * Abort the request with custom body and a status code when
337
- * passed condition returns `false`
338
- */
339
- abortUnless(conditional: any, body: any, status?: number): void;
340
- /**
341
- * Finishes the response by writing the lazy body, when `explicitEnd = true`
342
- * and response is already pending.
343
- *
344
- * Calling this method twice or when `explicitEnd = false` is noop.
345
- */
346
- finish(): void;
347
- continue(): void;
348
- switchingProtocols(): void;
349
- ok(body: any, generateEtag?: boolean): void;
350
- created(body?: any, generateEtag?: boolean): void;
351
- accepted(body: any, generateEtag?: boolean): void;
352
- nonAuthoritativeInformation(body: any, generateEtag?: boolean): void;
353
- noContent(): void;
354
- resetContent(): void;
355
- partialContent(body: any, generateEtag?: boolean): void;
356
- multipleChoices(body?: any, generateEtag?: boolean): void;
357
- movedPermanently(body?: any, generateEtag?: boolean): void;
358
- movedTemporarily(body?: any, generateEtag?: boolean): void;
359
- seeOther(body?: any, generateEtag?: boolean): void;
360
- notModified(body?: any, generateEtag?: boolean): void;
361
- useProxy(body?: any, generateEtag?: boolean): void;
362
- temporaryRedirect(body?: any, generateEtag?: boolean): void;
363
- badRequest(body?: any, generateEtag?: boolean): void;
364
- unauthorized(body?: any, generateEtag?: boolean): void;
365
- paymentRequired(body?: any, generateEtag?: boolean): void;
366
- forbidden(body?: any, generateEtag?: boolean): void;
367
- notFound(body?: any, generateEtag?: boolean): void;
368
- methodNotAllowed(body?: any, generateEtag?: boolean): void;
369
- notAcceptable(body?: any, generateEtag?: boolean): void;
370
- proxyAuthenticationRequired(body?: any, generateEtag?: boolean): void;
371
- requestTimeout(body?: any, generateEtag?: boolean): void;
372
- conflict(body?: any, generateEtag?: boolean): void;
373
- gone(body?: any, generateEtag?: boolean): void;
374
- lengthRequired(body?: any, generateEtag?: boolean): void;
375
- preconditionFailed(body?: any, generateEtag?: boolean): void;
376
- requestEntityTooLarge(body?: any, generateEtag?: boolean): void;
377
- requestUriTooLong(body?: any, generateEtag?: boolean): void;
378
- unsupportedMediaType(body?: any, generateEtag?: boolean): void;
379
- requestedRangeNotSatisfiable(body?: any, generateEtag?: boolean): void;
380
- expectationFailed(body?: any, generateEtag?: boolean): void;
381
- unprocessableEntity(body?: any, generateEtag?: boolean): void;
382
- tooManyRequests(body?: any, generateEtag?: boolean): void;
383
- internalServerError(body?: any, generateEtag?: boolean): void;
384
- notImplemented(body?: any, generateEtag?: boolean): void;
385
- badGateway(body?: any, generateEtag?: boolean): void;
386
- serviceUnavailable(body?: any, generateEtag?: boolean): void;
387
- gatewayTimeout(body?: any, generateEtag?: boolean): void;
388
- httpVersionNotSupported(body?: any, generateEtag?: boolean): void;
389
- }
390
- /**
391
- * Redirect interface
392
- */
393
- export interface RedirectContract {
394
- /**
395
- * Set a custom status code.
396
- */
397
- status(statusCode: number): this;
398
- /**
399
- * Clear existing query string values added using
400
- * "withQs"
401
- */
402
- clearQs(): this;
403
- /**
404
- * Forward the current QueryString or define one.
405
- */
406
- withQs(): this;
407
- withQs(values: Record<string, any>): this;
408
- withQs(name: string, value: any): this;
409
- /**
410
- * Redirect to the previous path.
411
- */
412
- back(): void;
413
- /**
414
- * Redirect the request using a route identifier.
415
- */
416
- toRoute(routeIdentifier: string, params?: any[] | MakeUrlOptions, options?: MakeUrlOptions): void;
417
- /**
418
- * Redirect the request using a path.
419
- */
420
- toPath(url: string): void;
421
- }
422
- /**
423
- * Config accepted by response the class
424
- */
425
- export type ResponseConfig = {
426
- etag: boolean;
427
- jsonpCallbackName: string;
428
- cookie: Partial<CookieOptions>;
429
- };
430
- /**
431
- * Shape of response constructor, we export the constructor for others to
432
- * add macros to the request class. Since, the instance is passed
433
- * to the http request cycle
434
- */
435
- export interface ResponseConstructorContract extends MacroableConstructorContract<ResponseContract> {
436
- new (request: IncomingMessage, response: ServerResponse, encryption: EncryptionContract, config: ResponseConfig, router: RouterContract): ResponseContract;
437
- }
438
- const Response: ResponseConstructorContract;
439
- export default Response;
440
- }
@@ -1,8 +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
- */