Skip to content

Commit

Permalink
fix: use unversioned api endpoint for tracker sub-resources (#1158)
Browse files Browse the repository at this point in the history
Co-authored-by: Olaniyan Folajimi <jimiolaniyan@gmail.com>
  • Loading branch information
mediremi and jimiolaniyan authored Apr 6, 2022
1 parent c3fe414 commit 1af1ca7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ describe('queryToResourcePath', () => {
)
})

it('should return an unversioned endpoint sub-resources of the new tracker importer (in version 2.37)', () => {
const query: ResolvedResourceQuery = {
resource: 'tracker/test',
}
expect(queryToResourcePath(link, query, 'read')).toBe(
`${link.unversionedApiPath}/tracker/test`
)
})

it('should return a VERSIONED endpoint for the new tracker importer (in version 2.38)', () => {
const query: ResolvedResourceQuery = {
resource: 'tracker',
Expand Down
2 changes: 1 addition & 1 deletion services/data/src/links/RestAPILink/queryToResourcePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const makeActionPath = (resource: string) =>
)

const skipApiVersion = (resource: string, config: Config): boolean => {
if (resource === 'tracker') {
if (resource === 'tracker' || resource.startsWith('tracker/')) {
if (!config.serverVersion?.minor || config.serverVersion?.minor < 38) {
return true
}
Expand Down

0 comments on commit 1af1ca7

Please sign in to comment.