File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
src/Elasticsearch/Endpoints
tests/Elasticsearch/Tests/Endpoints Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,15 @@ private function extractOptions(&$params)
249
249
{
250
250
// Extract out client options, then start transforming
251
251
if (isset ($ params ['client ' ]) === true ) {
252
+ // Check if the opaqueId is populated and add the header
253
+ if (isset ($ params ['client ' ]['opaqueId ' ]) === true ) {
254
+ if (isset ($ params ['client ' ]['headers ' ]) === false ) {
255
+ $ params ['client ' ]['headers ' ] = [];
256
+ }
257
+ $ params ['client ' ]['headers ' ]['x-opaque-id ' ] = [trim ($ params ['client ' ]['opaqueId ' ])];
258
+ unset($ params ['client ' ]['opaqueId ' ]);
259
+ }
260
+
252
261
$ this ->options ['client ' ] = $ params ['client ' ];
253
262
unset($ params ['client ' ]);
254
263
}
@@ -262,15 +271,6 @@ private function extractOptions(&$params)
262
271
$ this ->options ['client ' ]['ignore ' ] = [$ ignore ];
263
272
}
264
273
}
265
-
266
- // Check if the opaqueId is populated and add the header
267
- if (isset ($ params ['opaqueId ' ]) === true ) {
268
- if (isset ($ this ->options ['client ' ]['headers ' ]) === false ) {
269
- $ this ->options ['client ' ]['headers ' ] = [];
270
- }
271
- $ this ->options ['client ' ]['headers ' ]['x-opaque-id ' ] = [trim ($ params ['opaqueId ' ])];
272
- unset($ params ['opaqueId ' ]);
273
- }
274
274
}
275
275
276
276
private function convertCustom (array $ params ): array
Original file line number Diff line number Diff line change @@ -46,15 +46,15 @@ public function testInvalidParamsCauseErrorsWhenProvidedToSetParams(array $param
46
46
*/
47
47
public function testOpaqueIdInHeaders ()
48
48
{
49
- $ params = ['opaqueId ' => 'test_id_ ' . rand (1000 , 9999 )];
49
+ $ params = ['client ' => [ ' opaqueId ' => 'test_id_ ' . rand (1000 , 9999 )] ];
50
50
$ this ->endpoint ->setParams ($ params );
51
51
52
52
$ options = $ this ->endpoint ->getOptions ();
53
53
$ this ->assertArrayHasKey ('client ' , $ options );
54
54
$ this ->assertArrayHasKey ('headers ' , $ options ['client ' ]);
55
55
$ this ->assertArrayHasKey ('x-opaque-id ' , $ options ['client ' ]['headers ' ]);
56
56
$ this ->assertNotEmpty ($ options ['client ' ]['headers ' ]['x-opaque-id ' ]);
57
- $ this ->assertEquals ($ params ['opaqueId ' ], $ options ['client ' ]['headers ' ]['x-opaque-id ' ][0 ]);
57
+ $ this ->assertEquals ($ params ['client ' ][ ' opaqueId ' ], $ options ['client ' ]['headers ' ]['x-opaque-id ' ][0 ]);
58
58
}
59
59
60
60
}
You can’t perform that action at this time.
0 commit comments