Set charset on Orbit grep llm response

What does this MR do and why?

The llm response of the Orbit grep endpoint came back as text/plain with no charset, while the other Orbit plain-text responses declare UTF-8. Grep accepts multi-byte search terms, so a client that defaults to another charset could garble the output. This sets charset=utf-8 and asserts the header in the request spec.

Follow-up to !256404 (merged), raised by GitLab Duo on the 19.4 backport (!264303 (merged)).

Testing

On master the new spec assertion fails: expected: "text/plain; charset=utf-8", got: "text/plain". With the change, ee/spec/requests/api/orbit/data_grep_spec.rb passes (60 examples, 0 failures, 2 pending).

Performance Analysis

  • This merge request does not introduce any performance regression.
Agent context
  • present_orbit_grep in ee/lib/api/orbit/data.rb now passes text/plain; charset=utf-8 to content_type, matching present_orbit_context and the skill file endpoint.
  • Confirmed Grape/Rack adds no charset on its own: the unmodified endpoint returned Content-Type: text/plain.
  • The existing llm-format example now also checks response.headers['Content-Type']; media_type strips parameters so it could not catch this.
  • Rubocop clean on both files. Backporting is left to the Orbit backport hub.

Merge request reports

Loading
Loading