mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-20 01:09:57 +00:00
ui: Fix handling of MCP resource template parameters (#23117)
* Fix handling of MCP resource template parameters * Fix formatting for uri-template.test.ts --------- Co-authored-by: kuba <kuba@laptop.local.net>
This commit is contained in:
parent
1428004808
commit
b81c2cdd74
2 changed files with 9 additions and 1 deletions
|
|
@ -160,7 +160,7 @@ export function expandTemplate(template: string, values: Record<string, string>)
|
|||
(name: string, i: number) =>
|
||||
`${encodeURIComponent(name)}=${encodeURIComponent(expandedParts[i])}`
|
||||
)
|
||||
.join(URI_TEMPLATE_SEPARATORS.COMMA)
|
||||
.join(URI_TEMPLATE_SEPARATORS.QUERY_CONTINUATION)
|
||||
);
|
||||
case URI_TEMPLATE_OPERATORS.FORM_CONTINUATION:
|
||||
// Form-style query continuation
|
||||
|
|
|
|||
|
|
@ -107,6 +107,14 @@ describe('expandTemplate', () => {
|
|||
expect(result).toBe('http://example.com?q=search%20term');
|
||||
});
|
||||
|
||||
it('expands multiple query parameters', () => {
|
||||
const result = expandTemplate('http://example.com{?q,sort}', {
|
||||
q: 'search term',
|
||||
sort: 'descending'
|
||||
});
|
||||
expect(result).toBe('http://example.com?q=search%20term&sort=descending');
|
||||
});
|
||||
|
||||
it('keeps static parts unchanged', () => {
|
||||
const result = expandTemplate('http://example.com/static', {});
|
||||
expect(result).toBe('http://example.com/static');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue