nuxt / http

Universal HTTP Module for Nuxt.js
https://http.nuxtjs.org
MIT License
229 stars 51 forks source link

Default options are ignored when type is object #209

Open mickaelchanrion opened 2 years ago

mickaelchanrion commented 2 years ago

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