Skip to content

Commit

Permalink
Cleanup: Removing the requirement on configuring rawParser (#1762)
Browse files Browse the repository at this point in the history
Due to #1741 and #1745
  • Loading branch information
RobinTail committed May 12, 2024
1 parent 1548d84 commit 28ed00e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions example/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import express from "express";
import { createConfig } from "../src";
import ui from "swagger-ui-express";
import yaml from "yaml";
Expand All @@ -13,7 +12,6 @@ export const config = createConfig({
limitError: createHttpError(413, "The file is too large"), // affects uploadAvatarEndpoint
},
compression: true, // affects sendAvatarEndpoint
rawParser: express.raw(), // required for rawAcceptingEndpoint
beforeRouting: async ({ app }) => {
// third-party middlewares serving their own routes or establishing their own routing besides the API
const documentation = yaml.parse(
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/accept-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export const rawAcceptingEndpoint = taggedEndpointsFactory.build({
}),
output: z.object({ length: z.number().int().nonnegative() }),
handler: async ({ input: { raw } }) => ({
length: raw.length, // input.raw is populated automatically when rawParser is set in config
length: raw.length, // input.raw is populated automatically by the corresponding parser
}),
});

0 comments on commit 28ed00e

Please sign in to comment.