Skip to content

Support grape transformed headers when finding current organization

What does this MR do and why?

Currently we're supporting the header X-GitLab-Organization-ID to determine the current organization from headers. This specific header doesn't come through correctly when dealing with grape because grape transforms the headers.

The code below is an excerpt from the library which shows its using the String#capitalize method instead of passing through the raw headers from the client.

https://github.com/ruby-grape/grape/blob/v2.0.0/lib/grape/request.rb#L54

      def transform_header(header)
        -header[5..].split('_').map(&:capitalize).join('-')
      end

This MR aims to ensure that we support the normal header (X-GitLab-Organization-ID) and the grape transformation of said header (X-Gitlab-Organization-Id).

References

Closes Set current organization by header for v4 (grap... (#576243)
Created from this comment

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by tim mccarthy

Merge request reports

Loading