Skip to content

playground is loading schema directly from the baseurl, not considering the string path after first slash #184

@pobisw

Description

@pobisw

playground.cshtml has the below code which sets the url for fetching the schema in playground

  window.addEventListener('load', function (event) {
      GraphQLPlayground.init(document.getElementById('root'),
        {
          setTitle: true,
          endpoint: window.location.protocol + "//" + window.location.host + "@Model.GraphQLEndPoint",
          subscriptionEndpoint: (window.location.protocol === "http:" ? "ws://" : "wss://") + window.location.host + "@Model.GraphQLEndPoint",
          settings: {
            'tracing.hideTracingResponse': false
          }
        });
    })

This only consider the localtion.host part, but not the url path after that

for example if I load https://basepath/path1/path2/playground

it will try to load schema from https://basepath/graphql

because that is the value that comes in window.location.host

Expected Behavior : It should load schema from

https://basepath/path1/path2/graphql

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions