Skip to content

Commit 36483d8

Browse files
committed
chore: update path parameter syntax in documentation and tests to use brackets []
1 parent 8c0b24f commit 36483d8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/api/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const api = new ApiClient({
3737
},
3838
middlewares: [
3939
logger(),
40-
// replace path params from input. e.g. /users/:id to /users/1
40+
// replace path params from input. e.g. /users/[id] to /users/1
4141
replacePathParams(),
4242
],
4343
});

packages/api/src/client/middleware/replacePathParams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type ReplacePathParamsRequest = {
1818
};
1919

2020
/**
21-
* Replace url params with input. e.g. `/users/:id` to `/users/1`
21+
* Replace url params with input. e.g. `/users/[id]` to `/users/1`
2222
*/
2323
export function replacePathParams(
2424
options: ReplacePathParamsOptions = {},

packages/api/tests/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ describe('ApiClient', () => {
8686
],
8787
});
8888

89-
await apiClient.get('/test/:id')({ id: '123' });
89+
await apiClient.get('/test/[id]')({ id: '123' });
9090
expect(action).toHaveBeenCalledTimes(1);
9191
expect(action.mock.calls[0][0].req).toEqual({
9292
method: 'GET',
93-
rawUrl: '/test/:id',
93+
rawUrl: '/test/[id]',
9494
url: '/test/123',
9595
input: {},
9696
parsedInput: undefined,

0 commit comments

Comments
 (0)