A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/robsontenorio/vue-api-query/commit/4b12b184b9c3dd002a9521b88e9049ff959fd66e below:

prevent request config from ditching private data (#185) · robsontenorio/vue-api-query@4b12b18 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+2

-10

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+2

-10

lines changed Original file line number Diff line number Diff line change

@@ -38,7 +38,8 @@ export default class Model extends StaticModel {

38 38

}

39 39 40 40

config(config) {

41 -

this._config = config

41 +

Object.defineProperty(this, '_config', { get: () => config })

42 + 42 43

return this

43 44

}

44 45

@@ -313,11 +314,6 @@ export default class Model extends StaticModel {

313 314 314 315

// Check if config has data

315 316

if ('data' in _config) {

316 -

// Ditch private data

317 -

_config.data = Object.fromEntries(

318 -

Object.entries(_config.data).filter(([key]) => !key.startsWith('_'))

319 -

)

320 - 321 317

const _hasFiles = Object.keys(_config.data).some((property) => {

322 318

if (Array.isArray(_config.data[property])) {

323 319

return _config.data[property].some((value) => value instanceof File)

Original file line number Diff line number Diff line change

@@ -414,7 +414,6 @@ describe('Model methods', () => {

414 414 415 415

axiosMock.onAny().reply((config) => {

416 416

const _post = post

417 -

delete _post._config

418 417 419 418

expect(config.method).toEqual('patch')

420 419

expect(config.data).toEqual(JSON.stringify(_post))

@@ -452,7 +451,6 @@ describe('Model methods', () => {

452 451 453 452

axiosMock.onAny().reply((config) => {

454 453

const _post = post

455 -

delete _post._config

456 454 457 455

expect(config.method).toEqual('post')

458 456

expect(config.data).toEqual(JSON.stringify(_post))

@@ -572,7 +570,6 @@ describe('Model methods', () => {

572 570

axiosMock.onAny().reply((config) => {

573 571

let _data

574 572

const _post = post

575 -

delete _post._config

576 573 577 574

if (config.headers['Content-Type'] === 'multipart/form-data') {

578 575

_data = Object.fromEntries(config.data)

@@ -634,7 +631,6 @@ describe('Model methods', () => {

634 631

axiosMock.onAny().reply((config) => {

635 632

let _data

636 633

const _post = post

637 -

delete _post._config

638 634 639 635

if (config.headers['Content-Type'] === 'multipart/form-data') {

640 636

_data = JSON.stringify(Object.fromEntries(config.data))

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4