Skip to content

Commit ffba4a2

Browse files
authored
Merge pull request #87 from xiaohutai/feature/fix-menu-keep-bc
Set correct response header for `menu` and `taxonomy`
2 parents 0d4344b + 40d68eb commit ffba4a2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Action/MenuAction.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,19 @@ public function handle(Request $request)
4444
}
4545

4646
$menu = $this->boltConfig->get('menu' . $name, false);
47-
47+
4848
if (! $menu) {
4949
throw new ApiNotFoundException(
5050
"Menu with name [$name] not found."
5151
);
5252
}
5353

54-
return new ApiResponse([
54+
$response = new ApiResponse([
5555
'data' => $menu,
5656
], $this->extensionConfig);
57+
58+
$response->headers->set('Content-Type', 'application/json');
59+
60+
return $response;
5761
}
5862
}

src/Action/TaxonomyAction.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ public function handle(Request $request)
5151
);
5252
}
5353

54-
return new ApiResponse([
54+
$response = new ApiResponse([
5555
'data' => $taxonomy,
5656
], $this->extensionConfig);
57+
58+
$response->headers->set('Content-Type', 'application/json');
59+
60+
return $response;
5761
}
5862
}

0 commit comments

Comments
 (0)