pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.08k stars 1.6k forks source link

defaults function Update #685

Closed chinanf-boy closed 6 years ago

chinanf-boy commented 6 years ago

Reproduction Link

https://github.com/pagekit/vue-resource/blob/develop/src/http/index.js#L24

Steps to reproduce

vue-resource:v1.5.0

defaults(options || {}, self.$options, Http.options);

  1. if you can make options always True, then || {} is usefulness

  2. when !!options is Flase, {} put the defaults({},..) function, but return target no catch

https://github.com/pagekit/vue-resource/blob/develop/src/util.js#L155 - return target

What is Expected?

Request will use options, but seem like in 2, !options is False

https://github.com/pagekit/vue-resource/blob/develop/src/http/index.js#L38

return client(new Request(options)).then(response => {

What is actually Way?

So , a way is Add options = defaults(options || {}, self.$options, Http.options);

or Just del {} > defaults(options, self.$options, Http.options);


Hope that ISSUE is useful😊!!