MCPcopy Index your code
hub / github.com/tinyhttp/tinyhttp / makeReadonlySettable

Function makeReadonlySettable

examples/firebase-functions/src/index.ts:28–39  ·  view source on GitHub ↗

Hack for firebase functions request object, it was read only

(req: Request)

Source from the content-addressed store, hash-verified

26
27/** Hack for firebase functions request object, it was read only */
28function makeReadonlySettable(req: Request) {
29 return ['xhr', 'path'].forEach((key) => {
30 Object.defineProperty(req, key, {
31 get: function () {
32 return this[`_${key}`]
33 },
34 set: function (val) {
35 this[`_${key}`] = val
36 }
37 })
38 })
39}

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected