Commit 1e33caea authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'graphiql_relative_url' into 'master'

Fix GraphiQL when GitLab is installed under a relative URL

See merge request gitlab-org/gitlab!23143
parents 3b90528d aef340f4
---
title: Fix GraphiQL when GitLab is installed under a relative URL
merge_request: 23143
author: Mathieu Parent
type: fixed
post '/api/graphql', to: 'graphql#execute'
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql'
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/api/graphql')
::API::API.logger Rails.logger # rubocop:disable Gitlab/RailsLogger
mount ::API::API => '/'
# frozen_string_literal: true
require 'spec_helper'
describe 'GraphiQL' do
context 'without relative_url_root' do
before do
visit '/-/graphql-explorer'
end
it 'has the correct graphQLEndpoint' do
expect(page.body).to include('var graphQLEndpoint = "/api/graphql";')
end
end
context 'with relative_url_root' do
before do
stub_config_setting(relative_url_root: '/gitlab/root')
Rails.application.reload_routes!
visit '/-/graphql-explorer'
end
after do
Rails.application.reload_routes!
end
it 'has the correct graphQLEndpoint' do
expect(page.body).to include('var graphQLEndpoint = "/gitlab/root/api/graphql";')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment