Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/itchy-pots-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@litehex/node-vault": patch
---

Fixed issue in kv2 read method where version params caused misformed urls. See issue #109
10 changes: 7 additions & 3 deletions src/engine/kv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ export class Kv2 extends ApiSector {
method: 'GET',
path: '/{{mountPath}}/data/{{path}}',
client: this.client,
refine: (init, args) => {
if (args?.version !== undefined) {
const version = z.number().int().positive().parse(args.version);
init.url.searchParams.set('version', String(version));
}
return init;
},
schema: {
path: z.object({
mountPath: z.string(),
path: z.string()
}),
searchParams: z.object({
version: z.number().optional()
}),
response: SuccessResponseSchema.extend({
data: z.object({
data: z.record(z.string(), z.string()),
Expand Down