Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/DDTrace/Integrations/Swoole/SwooleIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,18 @@ static function (HookData $hook) use ($server, $scheme) {
$rootSpan->meta["http.useragent"] = $headers["user-agent"];
}

$rawContent = $request->rawContent();
if ($rawContent) {
// The raw content will always be populated if the request is a POST request, independent of the
// Content-Type header.
// However, it may not be json-decodable
$postFields = json_decode($rawContent, true);
if (is_null($postFields)) {
// Fallback to the post fields, which is an array
// This array is not always populated, depending on the Content-Type header
$postFields = $request->post;
if (!empty(\dd_trace_env_config('DD_TRACE_HTTP_POST_DATA_PARAM_ALLOWED'))) {
$rawContent = $request->rawContent();
if ($rawContent) {
// The raw content will always be populated if the request is a POST request, independent of
// the Content-Type header.
// However, it may not be json-decodable
$postFields = json_decode($rawContent, true);
if (is_null($postFields)) {
// Fallback to the post fields, which is an array
// This array is not always populated, depending on the Content-Type header
$postFields = $request->post;
}
}
}
if (!empty($postFields)) {
Expand Down
Loading