Skip to content

Commit c4f0015

Browse files
authored
Merge pull request #97 from Menkveld-24/patch-1
Fix collection merging bug
2 parents 9a83411 + 9525103 commit c4f0015

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Processors/RouteProcessor.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ protected function processRequest(string $method, Stringable $uri, Collection $r
167167
]);
168168

169169
if ($method === 'GET') {
170-
return $collection->put('url', [
171-
'query' => $rules->map(fn ($value) => array_merge($value, ['disabled' => false])),
170+
return $collection->mergeRecursive([
171+
'url' => [
172+
'query' => $rules->map(fn ($value) => array_merge($value, ['disabled' => false])),
173+
],
172174
]);
173175
}
174176

tests/Feature/ExportPostmanTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ public function test_rules_printing_get_export_works()
181181
->where('name', 'example/getWithFormRequest')
182182
->first();
183183

184+
$this->assertEqualsCanonicalizing([
185+
'raw' => '{{base_url}}/example/getWithFormRequest',
186+
'host' => [
187+
'{{base_url}}',
188+
],
189+
'path' => [
190+
'example',
191+
'getWithFormRequest',
192+
],
193+
'variable' => [],
194+
], array_slice($targetRequest['request']['url'], 0, 4));
195+
184196
$fields = collect($targetRequest['request']['url']['query']);
185197
$this->assertCount(1, $fields->where('key', 'field_1')->where('description', 'required'));
186198
$this->assertCount(1, $fields->where('key', 'field_2')->where('description', 'required, integer'));

0 commit comments

Comments
 (0)