Skip to content

Commit c19ecd6

Browse files
authored
fix: Correctly set addRequestContentFormat option (#131)
* fix: Correctly set addRequestContentFormat option. * test: Update addRequestContentFormat option tests.
1 parent a7f157a commit c19ecd6

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/runtime/composables/useDrupalCe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export const useDrupalCe = () => {
3737

3838
if (config.addRequestContentFormat) {
3939
useFetchOptions.query = useFetchOptions.query ?? {}
40-
useFetchOptions.query.addRequestContentFormat = config.addRequestContentFormat
40+
useFetchOptions.query._content_format = config.addRequestContentFormat
4141
}
4242

4343
const { data: page, error } = await useFetch(path, useFetchOptions)
44-
44+
4545
if (page?.value?.redirect) {
4646
await navigateTo(page.value.redirect.url, {
4747
external: page.value.redirect.external,

test/addRequestContentFormat/json.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Module addRequestContentFormat option set to json', async () => {
1818
})
1919
it('is correctly set in query', async () => {
2020
const html = await $fetch('/')
21-
expect(html).toContain('addRequestContentFormat=json')
22-
expect(html).not.toContain('addRequestContentFormat=markup')
21+
expect(html).toContain('_content_format=json')
22+
expect(html).not.toContain('_content_format=markup')
2323
})
2424
})

test/addRequestContentFormat/markup.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Module addRequestContentFormat set to markup', async () => {
1818
})
1919
it('is correctly set in query', async () => {
2020
const html = await $fetch('/')
21-
expect(html).toContain('addRequestContentFormat=markup')
22-
expect(html).not.toContain('addRequestContentFormat=json')
21+
expect(html).toContain('_content_format=markup')
22+
expect(html).not.toContain('_content_format=json')
2323
})
2424
})

test/addRequestContentFormat/unset.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ describe('Module addRequestContentFormat not set', async () => {
1717
})
1818
it('is correctly missing in query', async () => {
1919
const html = await $fetch('/')
20-
expect(html).not.toContain('addRequestContentFormat=')
20+
expect(html).not.toContain('_content_format=')
2121
})
2222
})

0 commit comments

Comments
 (0)