Skip to content

Commit

Permalink
fix(migrate): always use raw perspective for migrations (#8467)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored Jan 31, 2025
1 parent 53b8009 commit c317461
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {expect, test} from 'vitest'

import {endpoints} from '../endpoints'
import {toFetchOptions} from '../sanityRequestOptions'

test('toFetchOptions', () => {
expect(
toFetchOptions({
projectId: 'xyz',
apiVersion: 'v2025-01-31',
apiHost: 'api.sanity.io',
endpoint: endpoints.data.query('my-dataset'),
}),
).toEqual({
init: {
headers: {
'Content-Type': 'application/json',
'User-Agent': '@sanity/[email protected]',
},
method: 'GET',
},
url: 'https://xyz.api.sanity.io//v2025-01-31/query/my-dataset?perspective=raw',
})
})
2 changes: 1 addition & 1 deletion packages/@sanity/migrate/src/fetch-utils/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const endpoints = {
global: false,
method: 'GET',
path: `/query/${dataset}`,
searchParams: [],
searchParams: [['perspective', 'raw']],
}),
export: (dataset: string, documentTypes?: string[]): Endpoint => ({
global: false,
Expand Down

0 comments on commit c317461

Please sign in to comment.