mozilla / experimenter

A web application for managing user experiments for Mozilla Firefox.

Home Page:https://experimenter.services.mozilla.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Determine how HTTP_ is being prepended

jaredlockhart opened this issue · comments

It seems as if HTTP_ is being prepended to request headers in some tests and not others. Let's see if we can track down what's causing this.

┆Issue is synchronized with this Jira Task

So there's a line here in graphene:

https://github.com/graphql-python/graphene-django/blob/main/graphene_django/utils/testing.py#L60

that changes from embedding the request headers directly in the request call as **extra to headers=. Anything in headers= gets HTTP_ prepended, whereas anything in **extra is just left alone. So all of the V5 API tests that use self.query will wind up as headers= with HTTP_ prepended, whereas all the other tests that just embed the headers directly as **{....} will not.

This is all an artifact of Django/Graphene testing, in production the header for querying the openidc email is HTTP_X_FORWARDED_USER so we have to keep intact the case that we query for that header. It seems there's no good way to prevent the header from being rewritten in some tests or others, so I think just checking for both is the simplest thing to do for now.

I'm inclined to just close this and leave it as is.