Kubernetes 更改内容类型
Kubernetes changes content type
我在 PHP 有服务。
一个端点调用这些服务中的另一个端点。
对于连接,我使用 guzzle。
从第一个端点发送到第二个端点的内容应该是 application/json。
在 docker 它工作正常但是当我部署到 Kubernetes 时,
在日志中我看到请求内容是 application/x-www-form-urlencoded。
即使内容类型是硬编码的:
private function getPostRequestOptions($postData) : array
{
return [
'headers' => [
'Content-Type' => 'application/json',
'Request-ID' => $this->requestId
],
'body' => json_encode($postData),
'connect_timeout' => static::CONNECT_TIMEOUT,
'timeout' => static::TIMEOUT,
'http_errors' => true,
];
}
public function sendPost(string $path, $postData): \stdClass
{
return $this->executeRequest(
'POST',
$this->getFullUrl($path),
$this->getPostRequestOptions(
$postData
)
);
}
有人知道为什么会这样吗?
问题是 php 7 的 Dynatrace 监控。
新版插件停止切割headers.
我在 PHP 有服务。 一个端点调用这些服务中的另一个端点。 对于连接,我使用 guzzle。 从第一个端点发送到第二个端点的内容应该是 application/json。 在 docker 它工作正常但是当我部署到 Kubernetes 时, 在日志中我看到请求内容是 application/x-www-form-urlencoded。 即使内容类型是硬编码的:
private function getPostRequestOptions($postData) : array
{
return [
'headers' => [
'Content-Type' => 'application/json',
'Request-ID' => $this->requestId
],
'body' => json_encode($postData),
'connect_timeout' => static::CONNECT_TIMEOUT,
'timeout' => static::TIMEOUT,
'http_errors' => true,
];
}
public function sendPost(string $path, $postData): \stdClass
{
return $this->executeRequest(
'POST',
$this->getFullUrl($path),
$this->getPostRequestOptions(
$postData
)
);
}
有人知道为什么会这样吗?
问题是 php 7 的 Dynatrace 监控。 新版插件停止切割headers.