If your server is returning blank spaces but you want to validate them as null, either you or the server is wrong.
That said, you can easily validate anything you want using Karate:
* def isBlank = function(s){ return s ? ('' + s).trim() === '' : true }
* def foo = { bar: ' ' }
* match foo == { bar: '#? isBlank(_)' }
Or you could even use a RegEx:
* match foo == { bar: '#regex [ ]*' }
Please refer to the docs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…