hunk.code_window:     buildUniquenessTest(
         () => 'This environment variable is already defined.',
         'name'
       )
     );
   }
hunk.labels: keep replace keep keep keep keep
hunk.after_edit:       () => 'This environment variable is already defined',
  
hunk.file_path: app/react/components/form-components/EnvironmentVariablesFieldset/EnvironmentVariablesFieldset.tsx
hunk.type: replace
file: import $ from 'jquery';
  
  /* @ngInject */
  export function onStartupAngular($rootScope, $state, cfpLoadingBar, $transitions, HttpRequestHelper) {
    $rootScope.$state = $state;
  
    // Workaround to prevent the loading bar from going backward
    // https://github.com/chieffancypants/angular-loading-bar/issues/273
    const originalSet = cfpLoadingBar.set;
    cfpLoadingBar.set = function overrideSet(n) {
      if (n > cfpLoadingBar.status()) {
        originalSet.apply(cfpLoadingBar, arguments);
      }
    };
  
    $transitions.onBefore({}, () => {
      HttpRequestHelper.resetAgentHeaders();
    });
  
    $(document).ajaxSend((event, jqXhr, jqOpts) => {
      const type = jqOpts.type === 'POST' || jqOpts.type === 'PUT' || jqOpts.type === 'PATCH';
      const hasNoContentType = jqOpts.contentType !== 'application/json' && jqOpts.headers && !jqOpts.headers['Content-Type'];
      if (type && hasNoContentType) {
        jqXhr.setRequestHeader('Content-Type', 'application/json');
      }
      const csrfCookie = window.cookieStore.get('_gorilla_csrf');
      jqXhr.setRequestHeader('X-CSRF-Token', csrfCookie);
    });
  }
  