Skip to content

Commit f4a7798

Browse files
authored
1 parent 9a3edbb commit f4a7798

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Instances/Probe.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ public function getCommand()
5050
*/
5151
public function http(string $path = '/healthz', int $port = 8080, array $headers = [], string $scheme = 'HTTP')
5252
{
53-
return $this->setAttribute('httpGet', [
53+
$probeData = [
5454
'path' => $path,
5555
'port' => $port,
56-
'httpHeaders' => collect($headers)->map(function ($value, $key) {
57-
return ['name' => $key, 'value' => $value];
58-
})->values()->toArray(),
5956
'scheme' => $scheme,
60-
]);
57+
];
58+
59+
if (count($headers) > 0) {
60+
$probeData['httpHeaders'] = collect($headers)->map(function ($value, $key) {
61+
return ['name' => $key, 'value' => $value];
62+
})->values()->toArray();
63+
}
64+
65+
return $this->setAttribute('httpGet', $probeData);
6166
}
6267

6368
/**

0 commit comments

Comments
 (0)