nuxt / http

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

When creating a new instance, "headers" remains common to all instances #130

Closed Yaft closed 4 years ago

Yaft commented 4 years ago

Version

v0.5.12

Where?

https://github.com/nuxt/http/blob/0f274df66ea5a81e4d7e4cf709bfa7d109a5d730/lib/plugin.js#L57

Resolve example:

const { retry, timeout, prefixUrl, headers: { ...headers } } = this._defaults
Yaft commented 4 years ago

Sorry, my fail. I read the documentation again and understood

  const $api = $http.create({
    headers: {
      DateFormat: 'unix',
      Accept: 'application/json',
    },
  });

Correct initialization does not bind to _defaults variable