You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The defineProperty code is unnecessarily verbose. Consider
i. changing the defineProperty to getters e.g. get json () { return this.response.then(resp => resp.clone().json()) } or
ii. using ['json', 'blob', ...].forEach((n) => Object.defineProperty(this, n, {get: () => this.response.then(r => r.clone()[n]()}) or
iii. using defineProperties
Define setHeaders(obj = {}) and remove if (opts.headers)
change makeBody to a named function so that its name shows up when debugging
change setHeader (key, value) { this.setHeaders({ [key]: value }) }
have _args return this, then change all the http method methods (get, post, ...) to return this._args(...args)
The text was updated successfully, but these errors were encountered:
The defineProperty code is unnecessarily verbose. Consider
i. changing the defineProperty to getters e.g. get json () { return this.response.then(resp => resp.clone().json()) } or
ii. using ['json', 'blob', ...].forEach((n) => Object.defineProperty(this, n, {get: () => this.response.then(r => r.clone()[n]()}) or
iii. using defineProperties
Much like #10, consider some ES6ish things:
defineProperty
code is unnecessarily verbose. Consideri. changing the
defineProperty
to getters e.g.get json () { return this.response.then(resp => resp.clone().json()) }
orii. using
['json', 'blob', ...].forEach((n) => Object.defineProperty(this, n, {get: () => this.response.then(r => r.clone()[n]()})
oriii. using
defineProperties
setHeaders(obj = {})
and removeif (opts.headers)
makeBody
to a named function so that its name shows up when debuggingsetHeader (key, value) { this.setHeaders({ [key]: value }) }
_args
returnthis
, then change all the http method methods (get
,post
, ...) toreturn this._args(...args)
The text was updated successfully, but these errors were encountered: