MCPcopy
hub / github.com/axios/axios / buildAccessors

Function buildAccessors

lib/core/AxiosHeaders.js:64–78  ·  view source on GitHub ↗
(obj, header)

Source from the content-addressed store, hash-verified

62}
63
64function buildAccessors(obj, header) {
65 const accessorName = utils.toCamelCase(' ' + header);
66
67 ['get', 'set', 'has'].forEach((methodName) => {
68 Object.defineProperty(obj, methodName + accessorName, {
69 // Null-proto descriptor so a polluted Object.prototype.get cannot turn
70 // this data descriptor into an accessor descriptor on the way in.
71 __proto__: null,
72 value: function (arg1, arg2, arg3) {
73 return this[methodName].call(this, header, arg1, arg2, arg3);
74 },
75 configurable: true,
76 });
77 });
78}
79
80class AxiosHeaders {
81 constructor(headers) {

Callers 1

defineAccessorMethod · 0.85

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected