File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
src/Zipkin/Reporters/Http
tests/Integration/Reporters/Http Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 7
7
interface ClientFactory
8
8
{
9
9
/**
10
- * @param array $options
10
+ * @param array $options the options for HTTP call:
11
+ *
12
+ * <code>
13
+ * $options = [
14
+ * 'endpoint_url' => 'http://myzipkin:9411/api/v2/spans', // the reporting url for zipkin server
15
+ * 'headers' => ['X-API-Key' => 'abc123'] // the additional headers to be included in the request
16
+ * 'timeout' => 10, // the timeout for the request in seconds
17
+ * ];
18
+ * </code>
19
+ *
11
20
* @return callable(string):void
12
21
*/
13
22
public function build (array $ options ): callable ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public static function create(): self
29
29
/**
30
30
* {@inheritdoc}
31
31
*/
32
- public function build (array $ options = [] ): callable
32
+ public function build (array $ options ): callable
33
33
{
34
34
/**
35
35
* @param string $payload
@@ -50,6 +50,7 @@ public function build(array $options = []): callable
50
50
$ requiredHeaders = [
51
51
'Content-Type ' => 'application/json ' ,
52
52
'Content-Length ' => \strlen ($ payload ),
53
+ 'b3 ' => '0 ' ,
53
54
];
54
55
$ additionalHeaders = $ options ['headers ' ] ?? [];
55
56
$ headers = \array_merge ($ additionalHeaders , $ requiredHeaders );
Original file line number Diff line number Diff line change 2
2
3
3
namespace ZipkinTests \Integration \Reporters \Http ;
4
4
5
- use HttpTest \HttpTestServer ;
6
- use Psr \Http \Message \RequestInterface ;
7
- use Psr \Http \Message \ResponseInterface ;
8
- use RuntimeException ;
9
5
use Zipkin \Reporters \Http \CurlFactory ;
6
+ use RuntimeException ;
7
+ use Psr \Http \Message \ResponseInterface ;
8
+ use Psr \Http \Message \RequestInterface ;
10
9
use PHPUnit \Framework \TestCase ;
10
+ use HttpTest \HttpTestServer ;
11
11
12
12
/**
13
13
* @group ignore-windows
@@ -22,6 +22,7 @@ public function testHttpReportingSuccess()
22
22
function (RequestInterface $ request , ResponseInterface &$ response ) use ($ t ) {
23
23
$ t ->assertEquals ('POST ' , $ request ->getMethod ());
24
24
$ t ->assertEquals ('application/json ' , $ request ->getHeader ('Content-Type ' )[0 ]);
25
+ $ t ->assertEquals ('0 ' , $ request ->getHeader ('b3 ' )[0 ]);
25
26
$ response = $ response ->withStatus (202 );
26
27
}
27
28
);
You can’t perform that action at this time.
0 commit comments