Use HeaderBag in ApiController::saveInstanceAsPreset()

Created on 11 August 2025, 2 days ago

Problem/Motivation

  public function saveInstanceAsPreset(Request $request, string $builder_id, string $instance_id): HtmlResponse {
    $label = $this->t('New preset');
    foreach ($request->headers as $key => $value) {
      if ($key === 'hx-prompt' && !empty($value[0])) {
        $label = $value[0];
        break;
      }
    }
   ...

looks like a custom way of doing:

  public function saveInstanceAsPreset(Request $request, string $builder_id, string $instance_id): HtmlResponse {
    $request->headers->get('hx-prompt',  $this->t('New preset'));
   ...

Proposed resolution

Try the solution with https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/HttpFo...

📌 Task
Status

Active

Version

1.0

Component

Main / Misc.

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024