Remove from key from Web API request sent using jQuery.ajax().

@param \Magento\Framework\Webapi\Rest\Request\Deserializer\Json $subject
@param $encodedBody
@return array
196692
public function beforeDeserialize(
        \Magento\Framework\Webapi\Rest\Request\Deserializer\Json $subject,
        $encodedBody
    ) {
        if (strpos($encodedBody, '&form_key=')) {
            $parts = explode('&form_key=', $encodedBody);
            $encodedBody = reset($parts);
        }
        return [$encodedBody];
    }
1227915
public function decryptJsonRequestWithSharedKey(
        RequestInterface $request,
        SharedEncryptionKey $key
    ): array {
        $decrypted = $this->decryptRequestWithSharedKey(
            $request,
            $key
        );

        /** @var array|bool $array */
        $array = \json_decode(
            (string) $decrypted->getBody(),
            true
        );
        if (!\is_array($array)) {
            throw new InvalidMessageException('Could not decode JSON');
        }
        return $array;
    }
569268
protected function decodeBody(string $body) {
        $decoded_body = json_decode($body, true);

        if ($decoded_body === null || !is_array($decoded_body)) {
            $decoded_body = [];
        }

        return $decoded_body;
    }
1202557
protected function decodeResponseBody($responseBody)
    {
        // Response body is empty for HTTP 204 and 304 status code.
        if (empty($responseBody)) {
            return array();
        }

        $responseBody = json_decode($responseBody, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new DeserializeException('Unable to deserialize JSON data: ' . json_last_error_msg(), json_last_error());
        }

        return $responseBody;
    }
860378
public function decrypt($subject)
    {

        if ($this->key->getType() == CryptoKey::TYPE_SYMMETRIC) {
            $bitLen = $this->key->getBitLength();
            $method = 'AES-'. $bitLen .'-'. $this->aesMode;
            $encryptionKey = $this->key->getKey(CryptoKey::FORMAT_RAW);
            $ivLen = openssl_cipher_iv_length($method);
            $iv = substr($subject, 0, $ivLen);

            return openssl_decrypt(substr($subject, $ivLen), $method, $encryptionKey, OPENSSL_RAW_DATA, $iv);
        }

        $this->action = self::ACTION_DECRYPT;
        $this->subject = $subject;

        return $this;
    }
45102
protected function _deduplicateResultSet($subject)
    {
        $resultSet = clone $subject->entities;
        $ids = [];
        $keys = (array)$subject->query->getRepository()->getPrimaryKey();
        foreach ($subject->entities as $entity) {
            $id = $entity->extract($keys);
            if (!in_array($id, $ids)) {
                $entities[] = $entity;
                $ids[] = $id;
            }
        }

        if (isset($entities)) {
            $resultSet->unserialize(serialize($entities));
        }

        return $resultSet;
    }
113827
public function subject($subject = null)
    {
        deprecationWarning('Email::subject() is deprecated. Use Email::setSubject() or Email::getSubject() instead.');

        if ($subject === null) {
            return $this->getSubject();
        }

        return $this->setSubject($subject);
    }
32534
private function decodeBody(array $headers, $body)
    {
        $headers = array_change_key_case($headers);

        if (isset($headers['transfer-encoding']) && $headers['transfer-encoding'] === 'chunked') {
            for ($decodedBody = ''; !empty($body); $body = trim($body)) {
                $pos = strpos($body, "\r\n");
                $length = hexdec(substr($body, 0, $pos));
                $decodedBody .= substr($body, $pos + 2, $length);
                $body = substr($body, $pos + $length + 2);
            }

            return $decodedBody;
        }

        return $body;
    }
768965
public static function eliminateDupilcates($subject, $eliminate = "\\")
    {
        $pattern = $eliminate . $eliminate;

        while (strpos($subject, $pattern) !== false) {
            $subject = str_replace($pattern, $eliminate, $subject);
        }

        return $subject;
    }
1070182
private function decryptRequest(EncryptionKeyInterface $key, ServerRequestInterface $request, string $rawBody, int $version) :? string
    {
        static $response = null;
        static $nonce = null;
        static $publicKey = null;

        $response = new Response(
            $key->getBoxSecretKey()
        );

        if ($version === 1) {
            if (!$request->hasHeader('x-pubkey') || !$request->hasHeader('x-nonce')) {
                throw new Exception('Missing nonce or public key header. Unable to decrypt response.');
            }

            $publicKey = \base64_decode($request->getHeaderLine('x-pubkey'));
            $nonce = \base64_decode($request->getHeaderLine('x-nonce'));
        }

        $decryptedRequest = $response->decrypt(
            $rawBody,
            $publicKey,
            $nonce
        );

        $hashKey = $request->getHeaderLine('x-hashid');
        if ($key->isEphemeral()) {
            $this->cache->delete($hashKey);
        }

        return $decryptedRequest;
    }
522203
protected function parseSubject($subject)
    {
        $subject = imap_mime_header_decode($subject);

        $subjectParts = array_map(function ($subj) {
            if (strtolower($subj->charset) === 'default') {
                return $subj->text;
            }
            return iconv($subj->charset, static::$charset, $subj->text);
        }, $subject);

        return implode('', $subjectParts);
    }
254127
public function setBody($body) {
        if (is_string($body) || is_null($body)) {
            $this->rawBody = $this->body = $body;
        } elseif (is_array($body) || is_bool($body) || is_numeric($body) || $body instanceof \JsonSerializable) {
            $this->rawBody = json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
            $this->body = $body;
        } else {
            $this->rawBody = '';
            $this->body = $body;
        }

        return $this;
    }
599610
public function callback($opcode, $subject, $offset, $length)
    {
        if ($opcode === 'i') {
            return;
        }

        if ($opcode === 'c') {
            return  htmlentities(substr($subject, $offset, $length));
        }

        $deletion = substr($subject, $offset, $length);

        if (strcspn($deletion, " \n\r") === 0) {
            $deletion = str_replace(array("\n","\r"), array('\n','\r'), $deletion);
        }

        return '<del>'.htmlentities($deletion).'</del>';
    }
1038732
protected function encodeData($serializedData)
    {
        $result = json_encode($serializedData);
        if ($result === false) {
            $errorCode = json_last_error();
            throw new JsonException("Failed serialize json.", $errorCode);
        }

        return $result;
    }
728728
public function getClientKey($client_id, $subject)
    {
        if (isset($this->jwt[$client_id])) {
            $jwt = $this->jwt[$client_id];
            if ($jwt) {
                if ($jwt["subject"] == $subject) {
                    return $jwt["key"];
                }
            }
        }

        return null;
    }
1207109
public function serialize($subject, &$data = array(), SerializerInterface $serializer = null)
    {
        $context = $this->serializer();
        $context($subject, $data, $serializer);
        return $data;
    }
413842
public static function remove(array &$subjectArray, $keys)
    {
        $original =& $subjectArray;
        foreach ((array) $keys as $key) {
            self::removeSegments($subjectArray, $key);

            $subjectArray =& $original;
        }
    }