示例#1
0
 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);
 }
示例#2
0
 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();
     }
 }
示例#3
0
文件: Pipe.php 项目: uqiauto/fusio
 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);
 }