import type { NanotronClientRequest } from '@alwatr/nanotron-api-server'; import type { JsonObject, JsonArray } from '@alwatr/type-helper'; /** * Middleware to parses the request body as JSON and assigns it to `this.sharedMeta.body`. * If the body is empty or invalid, it sends an error response, * which triggers `terminatedHandlers` and prevents further handlers from executing. * * @this {NanotronClientRequest<{body: DictionaryOpt}>} * @returns {Promise} A promise that resolves when the body is successfully parsed or an error response is sent. * * @example * ```ts * nanotronApiServer.defineRoute<{body: DictionaryOpt}>({ * preHandlers: [parseBodyAsJson], * async handler() { * const body = this.sharedMeta.body; // json object * }, * }); * ``` */ export declare function parseBodyAsJson(this: NanotronClientRequest<{ body?: JsonObject | JsonArray; }>): Promise; //# sourceMappingURL=parse-body-as-json.d.ts.map