Skip to content

Code Completions Rest API - Add `X-GitLab-Error-Origin` header

What does this MR do and why?

Fixes #468347

This MR introduces a new header if the code_suggestions/completions REST api endpoint errors.

This is needed by EMs and PMs for reporting, see linked issue for the Why?.

MR acceptance checklist

Screenshots or screen recordings

How to set up and validate locally

See example below, run the same or equivalent such that the API throws an error, then verify the error for the X-GitLab-Error-Origin header:

POST http://gdk.test:3000/api/v4/code_suggestions/completions
Accept: application/json
Authorization: Bearer glpat-...
Content-Type: application/json

{
  "current_file": {
    "file_name": "lol.js",
    "content_above_cursor": "function alertHelloWorld() {\n",
    "content_below_cursor": "\n}"
  },
  "stream": false
}
Edited by Sri Rang

Merge request reports

Loading