public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context) { // parse json $parser = $this->templateFactory->newTextParser(); $response = $parser->parse($request, $context, $configuration->get('patch')); // patch $patch = new Patch(Json::decode($response, false)); $body = $patch->patch(Transformer::toStdClass($request->getBody())); $body = Transformer::toRecord($body); return $this->processor->execute($configuration->get('action'), $request->withBody($body), $context); }
protected function parseRequest(MethodAbstract $method) { if ($method->hasRequest()) { if ($method->getRequest()->getDefinition()->getName() == self::SCHEMA_PASSTHRU) { return Transformer::toRecord($this->getBody()); } else { return $this->getBodyAs($method->getRequest()); } } else { return new Record(); } }
public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context) { $response = $this->processor->execute($configuration->get('source'), $request, $context); $body = Transformer::toRecord($response->getBody()); return $this->processor->execute($configuration->get('destination'), $request->withBody($body), $context); }