I honestly don't think it is a good idea to do this in a "jQuery style". In any case, you need to provide a configuration object, so a little more characters don't matter much.
But the worst part is that when someone else sees your code, he will have no idea where the additional headers will come from, and he will probably spend hours of his life.
If you still want to have default headers somewhere, do it like this Javascript:
Y.myDefaultIOCfg={"My-Custom-Header":value} ... var cfg=Y.merge(Y.myDefaultIOCfg, { method: 'GET', data: 'foo=bar' }) request = Y.io(uri, cfg)
That way, you explicitly say that you are using an object as a template for the configuration object, and an additional header definition can be found there.
source share