raiton 5.9.4-beta.15 → 5.9.7-beta.18

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 (36) hide show
  1. package/build/bin/index.mjs +3 -1
  2. package/docs/README.md +136 -0
  3. package/docs/cli/README.md +81 -0
  4. package/docs/cli/commands.md +167 -0
  5. package/docs/cli/hmr.md +121 -0
  6. package/docs/core/README.md +67 -0
  7. package/docs/core/application.md +149 -0
  8. package/docs/core/builder-thread.md +231 -0
  9. package/docs/core/config.md +124 -0
  10. package/docs/core/controller.md +120 -0
  11. package/docs/core/injection.md +226 -0
  12. package/docs/core/middleware.md +172 -0
  13. package/docs/core/plugin-scope.md +171 -0
  14. package/docs/core/router.md +122 -0
  15. package/docs/framework/README.md +96 -0
  16. package/docs/framework/base-classes.md +214 -0
  17. package/docs/framework/decorators/README.md +60 -0
  18. package/docs/framework/decorators/controllable.md +151 -0
  19. package/docs/framework/decorators/injection.md +186 -0
  20. package/docs/framework/decorators/middleware.md +167 -0
  21. package/docs/framework/decorators/openapi.md +254 -0
  22. package/docs/framework/decorators/parametrable.md +248 -0
  23. package/docs/framework/decorators/socket.md +152 -0
  24. package/docs/framework/encryption.md +183 -0
  25. package/docs/framework/env.md +88 -0
  26. package/docs/framework/plugins/README.md +50 -0
  27. package/docs/framework/plugins/body-parser.md +138 -0
  28. package/docs/framework/plugins/openapi.md +217 -0
  29. package/docs/framework/plugins/security.md +159 -0
  30. package/docs/framework/responses.md +180 -0
  31. package/docs/framework/runtime.md +138 -0
  32. package/docs/types/README.md +206 -0
  33. package/package.json +1 -1
  34. package/source/core/application.ts +2 -0
  35. package/source/core/router/handler.ts +2 -0
  36. package/source/framework/decorators/route-interaction.decorator.ts +1 -1
@@ -0,0 +1,152 @@
1
+ # Décorateurs Socket
2
+
3
+ **Fichier :** `source/framework/decorators/socket.decorator.ts`
4
+ **Import :** `import { Socket, OnSocketConnect, OnSocketDisconnect, OnSocketMessage, OnSocketEvent } from "raiton/framework"`
5
+
6
+ > **Navigation :** [← middleware.md](middleware.md) | [↑ decorators/](README.md) | [openapi.md →](openapi.md)
7
+
8
+ Les décorateurs socket permettent de définir des handlers pour des événements de websocket.
9
+
10
+ ## `@Socket(namespace?)`
11
+
12
+ Marque une classe comme handler socket. Le namespace est optionnel (défaut: `"/"`).
13
+
14
+ ```typescript
15
+ @Socket("/chat")
16
+ export class ChatSocket {
17
+ // ...
18
+ }
19
+ ```
20
+
21
+ **Fonctionnement interne :**
22
+ 1. Appelle `@Injectable(LifetimeEnum.TRANSIENT, className)` → enregistre dans le DI
23
+ 2. Crée les métadonnées via `getSocketMetadata(target.prototype)` et définit le namespace
24
+
25
+ ## `@OnSocketConnect()`
26
+
27
+ Handler appelé à la connexion d'un client.
28
+
29
+ ```typescript
30
+ @Socket("/chat")
31
+ export class ChatSocket {
32
+ @OnSocketConnect()
33
+ onConnect() {
34
+ console.log("Client connecté au chat")
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## `@OnSocketDisconnect()`
40
+
41
+ Handler appelé à la déconnexion.
42
+
43
+ ```typescript
44
+ @Socket("/chat")
45
+ export class ChatSocket {
46
+ @OnSocketDisconnect()
47
+ onDisconnect() {
48
+ console.log("Client déconnecté du chat")
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## `@OnSocketMessage(name?)`
54
+
55
+ Handler pour les messages entrants.
56
+
57
+ ```typescript
58
+ @Socket("/chat")
59
+ export class ChatSocket {
60
+ @OnSocketMessage("message")
61
+ onMessage(data: any) {
62
+ console.log("Message reçu:", data)
63
+ // Répondre...
64
+ // this.send("response", { received: true })
65
+ }
66
+ }
67
+ ```
68
+
69
+ Si `name` est omis, le nom de la méthode est utilisé.
70
+
71
+ ## `@OnSocketEvent(name)`
72
+
73
+ Handler pour un événement socket nommé.
74
+
75
+ ```typescript
76
+ @Socket("/chat")
77
+ export class ChatSocket {
78
+ @OnSocketEvent("typing")
79
+ onTyping(data: { userId: string }) {
80
+ console.log(`${data.userId} est en train d'écrire...`)
81
+ }
82
+
83
+ @OnSocketEvent("join")
84
+ onJoin(data: { room: string }) {
85
+ console.log(`Rejoint le salon ${data.room}`)
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Exemple complet
91
+
92
+ ```typescript
93
+ import { Socket, OnSocketConnect, OnSocketDisconnect, OnSocketMessage, OnSocketEvent } from "raiton/framework"
94
+
95
+ @Socket("/chat")
96
+ export class ChatHandler {
97
+ private onlineUsers = new Map<string, string>()
98
+
99
+ @OnSocketConnect()
100
+ connected() {
101
+ console.log("Nouvelle connexion au chat")
102
+ }
103
+
104
+ @OnSocketDisconnect()
105
+ disconnected() {
106
+ console.log("Déconnexion du chat")
107
+ }
108
+
109
+ @OnSocketMessage("message")
110
+ handleMessage(data: { room: string; text: string; user: string }) {
111
+ console.log(`[${data.room}] ${data.user}: ${data.text}`)
112
+ // Diffuser aux autres clients...
113
+ }
114
+
115
+ @OnSocketEvent("join")
116
+ joinRoom(data: { room: string; user: string }) {
117
+ this.onlineUsers.set(data.user, data.room)
118
+ console.log(`${data.user} a rejoint ${data.room}`)
119
+ }
120
+
121
+ @OnSocketEvent("leave")
122
+ leaveRoom(data: { room: string; user: string }) {
123
+ this.onlineUsers.delete(data.user)
124
+ console.log(`${data.user} a quitté ${data.room}`)
125
+ }
126
+ }
127
+ ```
128
+
129
+ ## Métadonnées socket
130
+
131
+ Les métadonnées sont stockées via des symboles Reflect (voir `METADATA_KEYS.SOCKET_METADATA`) :
132
+
133
+ ```typescript
134
+ interface SocketMetaInterface {
135
+ namespace: string
136
+ events: Array<{
137
+ type: SocketEventType // "connect" | "disconnect" | "message" | "event"
138
+ name: string // Nom de l'événement
139
+ propertyKey: string // Nom de la méthode
140
+ }>
141
+ }
142
+ ```
143
+
144
+ ## Notes
145
+
146
+ - La fonctionnalité socket est en développement — le runtime sous-jacent est à implémenter
147
+ - Les décorateurs stockent les métadonnées mais le traitement effectif dépendra de l'adaptateur socket
148
+ - Utilisez `getSocketMetadata(target)` de `source/core/socket/metadata.ts` pour lire les métadonnées
149
+
150
+ ---
151
+
152
+ [← middleware.md](middleware.md) | [↑ decorators/](README.md) | [openapi.md →](openapi.md)
@@ -0,0 +1,183 @@
1
+ # Encryption
2
+
3
+ **Fichier :** `source/framework/encryption.ts`
4
+ **Import :** `import { Encryption, HashAlgoEnum, PasswordAlgoEnum, CipherAlgoEnum } from "raiton/framework"`
5
+
6
+ > **Navigation :** [← responses.md](responses.md) | [↑ framework/](README.md) | [env.md →](env.md)
7
+
8
+ Classe de hachage et chiffrement supportant multiples algorithmes.
9
+
10
+ ## Constructeur
11
+
12
+ ```typescript
13
+ const encrypt = new Encryption(HashAlgoEnum.SHA256)
14
+ const encrypt = new Encryption(HashAlgoEnum.ARGON2ID)
15
+ ```
16
+
17
+ ## Algorithmes supportés
18
+
19
+ ### Hachage simple (HashAlgoEnum)
20
+
21
+ | Algorithme | Description | Retour |
22
+ |-----------|-------------|--------|
23
+ | `SHA256` | SHA-2 256 bits | Hex string |
24
+ | `SHA512` | SHA-2 512 bits | Hex string |
25
+ | `MD5` | MD5 (128 bits) | Hex string |
26
+ | `RIPEMD160` | RIPEMD-160 | Hex string |
27
+ | `BLAKE2B` | BLAKE2b-512 | Hex string |
28
+ | `SHA3_256` | SHA-3 256 bits | Hex string |
29
+ | `SHA3_512` | SHA-3 512 bits | Hex string |
30
+
31
+ ### Dérivation de clé
32
+
33
+ | Algorithme | Description | Retour |
34
+ |-----------|-------------|--------|
35
+ | `PBKDF2` | Password-Based Key Derivation Function 2 | Format `pbkdf2$digest$iterations$salt$hash` |
36
+ | `SCRYPT` | Algorithme scrypt | Format `scrypt$N$r$p$salt$hash` |
37
+
38
+ ### Mots de passe
39
+
40
+ | Algorithme | Description | Dépendance |
41
+ |-----------|-------------|-----------|
42
+ | `ARGON2ID` | Argon2id (recommandé) | `argon2` |
43
+ | `BCRYPT` | bcrypt | `bcrypt` |
44
+
45
+ ## Méthodes
46
+
47
+ ### `make(value, options?)`
48
+
49
+ Hache une valeur selon l'algorithme choisi.
50
+
51
+ ```typescript
52
+ // SHA256
53
+ const sha256 = new Encryption(HashAlgoEnum.SHA256)
54
+ await sha256.make("mon-mot-de-passe")
55
+ // → "5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5"
56
+
57
+ // PBKDF2 avec options personnalisées
58
+ const pbkdf2 = new Encryption(HashAlgoEnum.PBKDF2)
59
+ await pbkdf2.make("secret", {
60
+ salt: "monsel",
61
+ iterations: 100_000,
62
+ keylen: 64,
63
+ digest: "sha512",
64
+ })
65
+ // → "pbkdf2$sha512$100000$monsel$..."
66
+
67
+ // Argon2id (recommandé pour mots de passe)
68
+ const argon = new Encryption(HashAlgoEnum.ARGON2ID)
69
+ await argon.make("mon-mot-de-passe")
70
+ // → "$argon2id$v=19$m=65536,t=3,p=4$..."
71
+
72
+ // bcrypt
73
+ const bcrypt = new Encryption(HashAlgoEnum.BCRYPT)
74
+ await bcrypt.make("mon-mot-de-passe")
75
+ // → "$2b$12$..."
76
+ ```
77
+
78
+ ### `compare(value, hash)`
79
+
80
+ Compare une valeur avec un hash (pour les algorithmes déterministes comme SHA).
81
+
82
+ ```typescript
83
+ const sha256 = new Encryption(HashAlgoEnum.SHA256)
84
+ const hash = await sha256.make("secret")
85
+ const match = await sha256.compare("secret", hash)
86
+ // → true
87
+ ```
88
+
89
+ ### `checkPassword(hash, password)`
90
+
91
+ Vérifie un mot de passe contre un hash argon2 ou bcrypt.
92
+
93
+ ```typescript
94
+ const argon = new Encryption(HashAlgoEnum.ARGON2ID)
95
+ const hash = await argon.make("mon-mot-de-passe")
96
+
97
+ const valid = await argon.checkPassword(hash, "mon-mot-de-passe")
98
+ // → true
99
+
100
+ const invalid = await argon.checkPassword(hash, "mauvais")
101
+ // → false
102
+ ```
103
+
104
+ ### `password(value, options?)`
105
+
106
+ Hache un mot de passe avec argon2 ou bcrypt spécifiquement.
107
+
108
+ ```typescript
109
+ const encrypt = new Encryption(HashAlgoEnum.ARGON2ID)
110
+
111
+ // Argon2 avec options
112
+ await encrypt.password("secret", {
113
+ type: argon2.argon2id,
114
+ memoryCost: 2 ** 16,
115
+ timeCost: 3,
116
+ parallelism: 2,
117
+ })
118
+
119
+ // bcrypt avec salt rounds spécifique
120
+ const encryptBcrypt = new Encryption(HashAlgoEnum.BCRYPT)
121
+ await encryptBcrypt.password("secret", 10) // 10 rounds
122
+ ```
123
+
124
+ ### `randomAlgo(algo?)`
125
+
126
+ Sélectionne un algorithme aléatoire parmi une liste.
127
+
128
+ ```typescript
129
+ const randomHash = Encryption.randomAlgo()
130
+ // → SHA256 ou SHA512 ou MD5...
131
+
132
+ const passwordHash = Encryption.randomAlgo([
133
+ PasswordAlgoEnum.BCRYPT,
134
+ PasswordAlgoEnum.ARGON2ID,
135
+ ])
136
+ ```
137
+
138
+ ## Exemple complet
139
+
140
+ ```typescript
141
+ import { Encryption, HashAlgoEnum } from "raiton/framework"
142
+
143
+ async function exemple() {
144
+ // 1. Hachage SHA256
145
+ const sha = new Encryption(HashAlgoEnum.SHA256)
146
+ const hash = await sha.make("données sensibles")
147
+ console.log(hash) // hex string
148
+
149
+ // 2. Hash de mot de passe avec argon2 (recommandé)
150
+ const passwordHash = new Encryption(HashAlgoEnum.ARGON2ID)
151
+ const pwd = await passwordHash.make("mon-mot-de-passe")
152
+
153
+ // 3. Vérification
154
+ const ok = await passwordHash.checkPassword(pwd, "mon-mot-de-passe")
155
+ console.log(ok) // true
156
+ }
157
+ ```
158
+
159
+ ## Utilisation dans un service
160
+
161
+ ```typescript
162
+ @Injectable(LifetimeEnum.SINGLETON)
163
+ class AuthService {
164
+ private encrypt = new Encryption(HashAlgoEnum.ARGON2ID)
165
+
166
+ async hashPassword(password: string): Promise<string> {
167
+ return await this.encrypt.make(password)
168
+ }
169
+
170
+ async verifyPassword(password: string, hash: string): Promise<boolean> {
171
+ return await this.encrypt.checkPassword(hash, password)
172
+ }
173
+
174
+ generateApiKey(): string {
175
+ const sha = new Encryption(HashAlgoEnum.SHA256)
176
+ return sha.make(crypto.randomUUID())
177
+ }
178
+ }
179
+
180
+ ---
181
+
182
+ [← responses.md](responses.md) | [↑ framework/](README.md) | [env.md →](env.md)
183
+ ```
@@ -0,0 +1,88 @@
1
+ # Variables d'Environnement
2
+
3
+ **Fichier :** `source/framework/env.ts`
4
+ **Import :** `import { env, envGroup } from "raiton/framework"`
5
+
6
+ > **Navigation :** [← encryption.md](encryption.md) | [↑ framework/](README.md) | [base-classes.md →](base-classes.md)
7
+
8
+ Accès typé aux variables d'environnement avec valeurs par défaut et validation de type.
9
+
10
+ ## `env(key, defaultValue?, type?)`
11
+
12
+ ```typescript
13
+ function env<T = string>(key: string, defaultValue?: T, type?: EnvType): T
14
+ ```
15
+
16
+ ### Usage simple
17
+
18
+ ```typescript
19
+ import { env } from "raiton/framework"
20
+
21
+ // String (défaut)
22
+ const name = env("APP_NAME", "RaitonApp")
23
+ // → process.env.APP_NAME ou "RaitonApp"
24
+
25
+ // Number
26
+ const port = env("PORT", 3000, Number)
27
+ // → Number(process.env.PORT) ou 3000
28
+
29
+ // Boolean
30
+ const debug = env("DEBUG", false, Boolean)
31
+ // → process.env.DEBUG === "true" ou false
32
+
33
+ // Sans valeur par défaut
34
+ const apiKey = env("API_KEY")
35
+ // → process.env.API_KEY ou undefined
36
+ ```
37
+
38
+ ### Avec typage
39
+
40
+ ```typescript
41
+ const port: number = env("PORT", 3000, Number)
42
+ const debug: boolean = env("DEBUG", false, Boolean)
43
+ const host: string = env("HOST", "localhost")
44
+ ```
45
+
46
+ ## `envGroup(prefix, schema?)`
47
+
48
+ Regroupe les variables d'environnement par préfixe.
49
+
50
+ ```typescript
51
+ import { env, envGroup } from "raiton/framework"
52
+
53
+ // Récupère toutes les variables DB_*
54
+ const dbConfig = envGroup("DB_")
55
+ // → { DB_HOST: "localhost", DB_PORT: "5432", DB_NAME: "mydb" }
56
+
57
+ // Avec mapping de types (si supporté)
58
+ const mapped = envGroup("REDIS_")
59
+ // → { REDIS_HOST: "localhost", REDIS_PORT: "6379" }
60
+ ```
61
+
62
+ ## Exemple typique
63
+
64
+ ```typescript
65
+ // .env
66
+ PORT=3000
67
+ DATABASE_URL=postgres://localhost:5432/mydb
68
+ REDIS_HOST=localhost
69
+ REDIS_PORT=6379
70
+ DEBUG=true
71
+ SECRET_KEY=my-secret-key
72
+
73
+ // config.ts
74
+ import { env } from "raiton/framework"
75
+ import { Application } from "raiton/core"
76
+
77
+ const app = new Application({
78
+ port: env("PORT", 3000, Number),
79
+ hostname: env("HOST", "0.0.0.0"),
80
+ verbose: env("DEBUG", false, Boolean),
81
+ })
82
+ ```
83
+
84
+ **Note :** `dotenv` est inclus dans les dépendances — le chargement du fichier `.env` est géré automatiquement ou via le bootstrapper.
85
+
86
+ ---
87
+
88
+ [← encryption.md](encryption.md) | [↑ framework/](README.md) | [base-classes.md →](base-classes.md)
@@ -0,0 +1,50 @@
1
+ # Plugins Intégrés
2
+
3
+ **Fichiers :** `source/framework/plugins/`
4
+ **Import :** `import { bodyParserPlugin, openApiPlugin, Security } from "raiton/framework"`
5
+
6
+ > **Navigation :** [← framework/](../README.md) | [↑ framework/](../README.md) | [body-parser.md →](body-parser.md)
7
+
8
+ ## Table des matières
9
+
10
+ | Fichier | Description |
11
+ |---------|-------------|
12
+ | [body-parser.md](body-parser.md) | Parsing du corps de requête |
13
+ | [openapi.md](openapi.md) | Génération de documentation OpenAPI 3.0 |
14
+ | [security.md](security.md) | CORS, en-têtes de sécurité, rate-limit, body-limit |
15
+
16
+ ## Liste des plugins
17
+
18
+ | Plugin | Description | Activé par défaut ? |
19
+ |--------|-------------|-------------------|
20
+ | `bodyParserPlugin()` | Parse le corps des requêtes (JSON, form, multipart, text) | Oui (automatique) |
21
+ | `openApiPlugin(options)` | Génère une spec OpenAPI 3.0 + endpoint JSON | Non |
22
+ | `Security.headers` | Middleware d'en-têtes de sécurité HTTP | Oui (automatique) |
23
+ | `Security.cors(options)` | Middleware CORS | Non |
24
+ | `Security.rateLimit(options)` | Rate limiting | Non |
25
+ | `Security.bodyLimit(options)` | Limitation de taille du body | Non |
26
+ | `Security.methodGuard(options)` | Restriction des méthodes HTTP | Non |
27
+
28
+ ## Activation automatique
29
+
30
+ Dans `Application.initialize()` :
31
+
32
+ ```typescript
33
+ protected initialize(): this {
34
+ this.register(Security.headers) // Toujours activé
35
+ this.register(bodyParserPlugin()) // Toujours activé
36
+ return this
37
+ }
38
+ ```
39
+
40
+ ## Documentation détaillée
41
+
42
+ | Fichier | Description |
43
+ |---------|-------------|
44
+ | `body-parser.md` | Parsing du corps de requête (JSON, multipart, URL-encoded, text) |
45
+ | `openapi.md` | Génération de documentation OpenAPI 3.0 |
46
+ | `security.md` | Plugins de sécurité (CORS, headers, rate-limit, body-limit, method-guard) |
47
+
48
+ ---
49
+
50
+ [← framework/](../README.md) | [↑ framework/](../README.md) | [body-parser.md →](body-parser.md)
@@ -0,0 +1,138 @@
1
+ # Body Parser Plugin
2
+
3
+ **Fichier :** `source/framework/plugins/body-parser.plugin.ts`
4
+ **Import :** `import { bodyParserPlugin } from "raiton/framework"`
5
+
6
+ > **Navigation :** [← plugins/](README.md) | [↑ plugins/](README.md) | [openapi.md →](openapi.md)
7
+
8
+ Middleware de parsing automatique du corps des requêtes HTTP. Activé automatiquement par `Application.initialize()`.
9
+
10
+ ```typescript
11
+ bodyParserPlugin(): PluginInterface
12
+ ```
13
+
14
+ ## Formats supportés
15
+
16
+ | Content-Type | Résultat |
17
+ |-------------|----------|
18
+ | `application/json` | `req.body` → objet JSON parsé |
19
+ | `multipart/form-data` | `req.body` → champs, `req.files` → tous les fichiers, `req.file` → premier fichier |
20
+ | `application/x-www-form-urlencoded` | `req.body` → `Record<string, string>` |
21
+ | `text/*` | `req.body` → string brute |
22
+ | `GET/HEAD` (sans body) | `req.body` = `req.query` (query string parsée) |
23
+
24
+ ## Propriétés résultantes
25
+
26
+ ```typescript
27
+ // Après le passage du bodyParserPlugin :
28
+ context.req.body // Corps parsé (objet, Record, string, ou Uint8Array)
29
+ context.req.query // Query string parsée en Record<string, string>
30
+ context.req.files // Fichiers uploadés (multipart) : Record<string, FileInfo>
31
+ context.req.file // Premier fichier uploadé (multipart)
32
+
33
+ // FileInfo structure :
34
+ interface FileInfo {
35
+ name: string
36
+ type: string
37
+ size: number
38
+ lastModified: number
39
+ buffer: Buffer
40
+ }
41
+ ```
42
+
43
+ ## Exemples
44
+
45
+ ### JSON
46
+
47
+ ```typescript
48
+ @Controllable("/users")
49
+ export class UserController {
50
+ @Post("/")
51
+ create(@Body() data: { name: string; email: string }) {
52
+ // Content-Type: application/json
53
+ // Body: {"name": "Alice", "email": "alice@example.com"}
54
+ // → data = { name: "Alice", email: "alice@example.com" }
55
+ return { success: true, data }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### Formulaire URL-encodé
61
+
62
+ ```typescript
63
+ @Controllaro("/form")
64
+ export class FormController {
65
+ @Post("/submit")
66
+ submit(@Body() data: Record<string, string>) {
67
+ // Content-Type: application/x-www-form-urlencoded
68
+ // Body: name=Alice&email=alice@example.com
69
+ // → data = { name: "Alice", email: "alice@example.com" }
70
+ return data
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### Multipart (upload de fichiers)
76
+
77
+ ```typescript
78
+ @Controllable("/files")
79
+ export class FileController {
80
+ @Post("/upload")
81
+ upload(
82
+ @Body() fields: Record<string, string>,
83
+ @UploadedFile("avatar") file?: {
84
+ name: string
85
+ type: string
86
+ size: number
87
+ buffer: Buffer
88
+ },
89
+ ) {
90
+ // Content-Type: multipart/form-data
91
+ // Fields: { description: "Mon avatar" }
92
+ // File: avatar (fichier image)
93
+ return {
94
+ fileName: file?.name,
95
+ fileSize: file?.size,
96
+ description: fields.description,
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Query string (GET/HEAD)
103
+
104
+ ```typescript
105
+ @Controllable("/search")
106
+ export class SearchController {
107
+ @Get("/")
108
+ search(@Query() query: Record<string, string>) {
109
+ // GET /search?q=hello&lang=fr
110
+ // → req.query = { q: "hello", lang: "fr" }
111
+ // → req.body = req.query (car GET)
112
+ return query
113
+ }
114
+ }
115
+ ```
116
+
117
+ ## Accès au body brut
118
+
119
+ Pour les `Content-Type` non reconnus, le body reste sous forme de `Uint8Array` :
120
+
121
+ ```typescript
122
+ @Controllable("/raw")
123
+ export class RawController {
124
+ @Post("/data")
125
+ receive(@Req() req: any) {
126
+ if (!req.state.bodyParsed) {
127
+ // Body non parsé → accès en brut
128
+ const rawBody = req.body as Uint8Array
129
+ return { length: rawBody.length }
130
+ }
131
+ return { parsed: req.body }
132
+ }
133
+ }
134
+
135
+ ---
136
+
137
+ [← plugins/](README.md) | [↑ plugins/](README.md) | [openapi.md →](openapi.md)
138
+ ```