diff --git a/CHANGELOG.md b/CHANGELOG.md index cb30d89..647f935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ Формат основан на [Keep a Changelog](https://keepachangelog.com/ru/1.0.0/), и этот проект придерживается [Semantic Versioning](https://semver.org/lang/ru/). +## [3.1.1] - 2025-11-08 + +### Исправлено + +- Исправлен парсинг path-параметров в утилите `parseApiRequest`, чтобы корректно обрабатывать фигурные скобки в URL + ## [3.1.0] - 2025-11-06 ### Добавлено diff --git a/package.json b/package.json index 78c1cb6..ede9b16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gratio/api", - "version": "3.1.0", + "version": "3.1.1", "description": "TypeScript common types for Gratio projects API responses and requests", "homepage": "https://github.com/Gratio-tech/Api#readme", "packageManager": "bun@1.2.17", diff --git a/src/utils/parseApiRequest.ts b/src/utils/parseApiRequest.ts index d9d59a4..88e88cf 100644 --- a/src/utils/parseApiRequest.ts +++ b/src/utils/parseApiRequest.ts @@ -24,7 +24,9 @@ export function parseApiRequest(request: ApiRequest): Request { // Parse path parameters for (const [key, value] of Object.entries(request.pathParams || {})) { - url.pathname = url.pathname.replace(`{${key}}`, encodeURIComponent(String(value))); + // %7B = { + // %7D = } + url.pathname = url.pathname.replace(new RegExp(`%7B${key}%7D`, 'g'), encodeURIComponent(String(value))); } // Parse headers