HTTP Delete.

The HTTP delete method, deletes a given uri

@param RequestInterface  $request
@param ResponseInterface $response
553511
public function httpDelete(RequestInterface $request, ResponseInterface $response)
    {
        $path = $request->getPath();

        if (!$this->server->emit('beforeUnbind', [$path])) {
            return false;
        }
        $this->server->tree->delete($path);
        $this->server->emit('afterUnbind', [$path]);

        $response->setStatus(204);
        $response->setHeader('Content-Length', '0');

        // Sending back false will interrupt the event chain and tell the server
        // we've handled this method.
        return false;
    }
641512
protected function saveToCache(
        RequestInterface $request,
        ResponseInterface $response
    ): bool {
        $key = $this->getCacheItemKey($request);

        try {
            $body = (string) $response->getBody();
            rewind_body($response);

            $cacheItem = $this
                ->cache
                ->getItem($key)
                ->expiresAfter(new \DateInterval($this->cacheTtl))
                ->set([
                    GuzzleClientMiddlewareInterface::BODY    => $body,
                    GuzzleClientMiddlewareInterface::HEADERS => $response->getHeaders(),
                    GuzzleClientMiddlewareInterface::STATUS  => $response->getStatusCode(),
                    GuzzleClientMiddlewareInterface::REASON  => $response->getReasonPhrase(),
                    GuzzleClientMiddlewareInterface::VERSION => $response->getProtocolVersion(),
                ]);
        } catch (InvalidArgumentException | \Exception $e) {
            if (null !== $this->logger) {
                $this->logger->error($e->getMessage());
            }

            return false;
        }

        $result = $this->cache->save($cacheItem);

        if ($result && null !== $this->logger) {
            $this->logger->info('Guzzle request result is saved to cache', [
                GuzzleClientMiddlewareInterface::URI => (string) $request->getUri(),
            ]);
        }

        return $result;
    }
368507
public function deleteAction(Request $request)
    {
        $siterootId = $request->get('id');

        $siterootManager = $this->get('phlexible_siteroot.siteroot_manager');

        $siteroot = $siterootManager->find($siterootId);
        $siterootManager->deleteSiteroot($siteroot);

        return new ResultResponse(true, 'Siteroot deleted.');
    }
1333956
public RestResponse delete(final String uri) throws IOException, AppPlatformException {
        return request(getPath(uri), HttpDelete.METHOD_NAME);
    }
960347
protected function getRefreshUri(RequestInterface $request, ResponseInterface $response)
    {
        if (preg_match(static::REFRESH_EXPRESSION, $response->getHeaderLine('Refresh'), $matches)) {
            return new Uri($matches[1]);
        }

        return $this->solveJavascriptChallenge($request, $response);
    }
141009
protected function httpDelete($uri)
    {
        $this->log[] = [
                        'request' => [
                                    'method' => 'DELETE',
                                    'uri'    => $uri,
                                    ],
                        ];
        $response = \Httpful\Request::delete($uri)
                                                ->addHeader('X-Auth-Email', $this->email)
                                                ->addHeader('X-Auth-Key', $this->apikey)
                                                ->expects(\Httpful\Mime::JSON)
                                                ->parseWith(function ($body) {
                                                    return \Metaclassing\Utility::decodeJson($body);
                                                })
                                                ->send()
                                                ->body;
        $this->log[count($this->log) - 1]['response'] = $response;
        if ($response['success'] != true) {
            throw new \Exception("delete to {$uri} unsuccessful");
        }

        return $response['result'];
    }
176732
public function delete( ServerRequestInterface $request, ResponseInterface $response )
	{
		$view = $this->getView();

		try
		{
			$this->clearCache();

			$status = 200;
			$type = $view->param( 'id', 'default' );
			$view->item = $this->controller->setType( $type )->clear()->get();
		}
		catch( \Aimeos\MShop\Plugin\Provider\Exception $e )
		{
			$status = 409;
			$errors = $this->translatePluginErrorCodes( $e->getErrorCodes() );
			$view->errors = $this->getErrorDetails( $e, 'mshop' ) + $errors;
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$status = 404;
			$view->errors = $this->getErrorDetails( $e, 'mshop' );
		}
		catch( \Exception $e )
		{
			$status = 500;
			$view->errors = $this->getErrorDetails( $e );
		}

		return $this->render( $response, $view, $status );
	}
566706
public function handle(ResourceInterface $resource, RepositoryInterface $repository): void
    {
        try {
            $this->decoratedHandler->handle($resource, $repository);
        } catch (ORMException $exception) {
            throw new DeleteHandlingException();
        }
    }
1226164
protected function removeHandle(RequestInterface $request)
    {
        if (isset($this->handles[$request])) {
            $handle = $this->handles[$request];
            unset($this->handles[$request]);
            unset($this->resourceHash[(int) $handle->getHandle()]);
            curl_multi_remove_handle($this->multiHandle, $handle->getHandle());
            $handle->close();
        }
    }
455091
public function terminate(Request $request, Response $response)
    {
        $event = new PostResponseEvent($this, $request, $response);
        $this->getDispatcher()->dispatch(KernelEvents::TERMINATE, $event);
    }
20764
public function setRequestAllowance(RequestInterface $request, ResponseInterface $response)
    {
        $route = $this->getRoute($request);

        $remaining = $response->getHeader('X-RateLimit-Remaining');
        $reset     = $response->getHeader('X-RateLimit-Reset');
        if (empty($remaining) || empty($reset) || (int) $remaining[0] > 0) {
            return;
        }

        $this->routes[$route]['reset'] = $reset[0];
    }
1201240
public function fromResponse(RequestInterface $request, Response $response)
	{
		$message = $response->json();

		$parts = array(
			'type' => isset($message['error']) ? $message['error'] : null,
			'description' => isset($message['description']) ? $message['description'] : null,
			'request_id' => $response->getHeaders()->get('x-kinvey-request-id'),
			'debug' => isset($message['debug']) && !empty($message['debug']) ? $message['debug'] : null,
		);

		return $this->createException($request, $response, $parts);
	}
1074516
public function delete($uri, $parameters = array())
    {
        return $this->request(self::DELETE, $this->getUrl($uri), $parameters);
    }
128866
private function handleRequest(RequestInterface $request, ResponseInterface $response): void
    {
        foreach ($this->routes as $route) {
            $routeMatch = $route->matches($request);

            if ($routeMatch === null) {
                continue;
            }

            $controllerClass = $routeMatch->getControllerClassName();
            $controller = new $controllerClass();

            /** @var ControllerInterface $controller */
            $controller->processRequest($this, $request, $response, $routeMatch->getAction(), $routeMatch->getParameters());

            return;
        }

        $response->setStatusCode(new StatusCode(StatusCode::NOT_FOUND));
    }
111007
public XcapResponse delete(URI uri, Header[] additionalRequestHeaders,
			Credentials credentials) throws IOException {

		if (log.isDebugEnabled()) {
			log.debug("delete(uri=" + uri + " , additionalRequestHeaders = ( "
					+ Arrays.toString(additionalRequestHeaders) + " ) )");
		}

		return execute(new HttpDelete(uri), additionalRequestHeaders,
				credentials);
	}
598973
public function processRequest(RequestInterface $request, ResponseInterface $response)
    {
        $this->result = new AjaxResult;

        try {
            $this->processRequestParent($request, $response);
        } catch (Exception $exception) {
            if (false === $this->protectedRequestMode) {
                throw $exception;
            }

            $this->result->clear();

            $errorMessage = ExtensionService::get()->isInDebugMode()
                ? $this->getDebugMessageForException($exception)
                : ContextService::get()->translate(self::DEFAULT_ERROR_MESSAGE_KEY);

            $error = new Error($errorMessage, 1490176818);
            $this->result->addError($error);
            $this->result->setData('errorCode', $exception->getCode());
        }

        // Cleaning every external message.
        ob_clean();

        $this->injectResultInResponse();
    }
1355778
protected function httpDelete(string $path, array $params = [], array $requestHeaders = []): ResponseInterface
    {
        return $this->httpClient->sendRequest(
            $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createJsonBody($params))
        );
    }