Skip to content

Commit 057ba4e

Browse files
Support checking all fields
1 parent 1bdcdf6 commit 057ba4e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/core/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const resolveConfig = (config: Config): Config => {
139139
...config.precognitive !== false ? {
140140
Precognition: true,
141141
} : {},
142-
...only ? {
142+
...only && Array.from(only).length ? {
143143
'Precognition-Validate-Only': Array.from(only).join(),
144144
} : {},
145145
},

packages/core/tests/validator.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,22 @@ it('supports async validate with only key for untouched values', async () => {
704704
await assertPendingValidateDebounceAndClear()
705705
})
706706

707+
it('supports async validate without only key', async () => {
708+
let config
709+
axios.request.mockImplementation((c) => {
710+
config = c
711+
712+
return Promise.resolve({ headers: { precognition: 'true', 'precognition-success': 'true' }, status: 204, data: '' })
713+
})
714+
const validator = createValidator((client) => client.post('/foo', {}))
715+
716+
validator.validate()
717+
718+
expect(config.headers).not.toHaveProperty('Precognition-Validate-Only')
719+
720+
await assertPendingValidateDebounceAndClear()
721+
})
722+
707723
it('supports async validate with depricated validate key for untouched values', async () => {
708724
let config
709725
axios.request.mockImplementation((c) => {

0 commit comments

Comments
 (0)