http icon indicating copy to clipboard operation
http copied to clipboard

Default options are ignored when type is object

Open mickaelchanrion opened this issue 3 years ago • 0 comments

When an option is an object (e.i.: headers, queryParams), the defaults are always overridden if defined again.

Ex: Screenshot 2022-06-28 at 19 24 13

I think the culprit is located here: https://github.com/nuxt/http/blob/1b9b21e6e51df55079c90c07cc129408912ab609/lib/plugin.js#L85

After updating ky + replace this line by:

const _options = defu(options, this._defaults)

everything is back in order

mickaelchanrion avatar Jun 28 '22 18:06 mickaelchanrion