MCPcopy Index your code
hub / github.com/ParallelTask/dinoloop / handleHttpBody

Method handleHttpBody

src/modules/core/dino.controller.ts:88–113  ·  view source on GitHub ↗
(values: IKeyValuePair[])

Source from the content-addressed store, hash-verified

86 // made public for unit-test, not available on contract
87 // invokes handler only for http-body
88 handleHttpBody(values: IKeyValuePair[]): void {
89 let attr = this.controllerAction.actionAttributes;
90
91 // If http-request has body, first parameter gets request-body injected
92 if (HttpUtility.hasBody(attr.httpVerb)) {
93
94 // http-body injected to first parameter i.e. index == 0
95 let arg =
96 attr.actionArguments
97 .filter(x => x.paramIndex === 0)[0];
98 if (DataUtility.isUndefined(arg)) {
99 values[0] = {
100 value: this.controller.request.body
101 };
102 } else {
103 values[0] = { key: arg.key };
104 values[0].value = arg.handler({
105 action: arg.action,
106 controller: arg.controller,
107 key: arg.key,
108 data: arg.data,
109 value: this.controller.request.body
110 }, this.controller.model);
111 }
112 }
113 }
114
115 // made public for unit test and not available on interface contract
116 // result returned by action method, makes available to next middleware

Callers 1

invokeSetUpMethod · 0.95

Calls 1

handlerMethod · 0.80

Tested by

no test coverage detected