v0.3.0
Minor Changes
-
#33
1f3958d
Thanks @christoph-fricke! - Addedquery
helper to resolver-info argument. It provides a type-safe wrapper aroundURLSearchParams
for reading search parameters. As usual, the information about available parameters is inferred from your OpenAPI spec./* Imagine this endpoint specification for the following example: /query-example: get: summary: Query Example operationId: getQueryExample parameters: - name: filter in: query required: true schema: type: string - name: page in: query schema: type: number - name: sort in: query required: false schema: type: string enum: ["asc", "desc"] - name: sortBy in: query schema: type: array items: type: string */ const handler = http.get("/query-example", ({ query }) => { const filter = query.get("filter"); // Typed as string const page = query.get("page"); // Typed as string | null since it is not required const sort = query.get("sort"); // Typed as "asc" | "desc" | null const sortBy = query.getAll("sortBy"); // Typed as string[] // Supported methods from URLSearchParams: get(), getAll(), has(), size if (query.has("sort", "asc")) { /* ... */ } return HttpResponse.json({ /* ... */ }); });
-
#35
07fa9b0
Thanks @christoph-fricke! - Restructured the library to add support for additional response resolver info. The enhancedResponseResolver
type andResponseResolverInfo
are available as exports.