Fix cookie passing in web ui

This commit is contained in:
Vikram Rangnekar 2019-06-04 20:00:24 -04:00
parent 6d370029e9
commit 5f6ea226a3
4 changed files with 111 additions and 95 deletions

View File

@ -85,12 +85,42 @@ func apiv1Http(w http.ResponseWriter, r *http.Request) {
} }
if strings.EqualFold(ctx.req.OpName, introspectionQuery) { if strings.EqualFold(ctx.req.OpName, introspectionQuery) {
dat, err := ioutil.ReadFile("test.schema") // dat, err := ioutil.ReadFile("test.schema")
if err != nil { // if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) // http.Error(w, err.Error(), http.StatusInternalServerError)
return // return
// }
//w.Write(dat)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": null,
"subscriptionType": null
} }
w.Write(dat) },
"extensions":{
"tracing":{
"version":1,
"startTime":"2019-06-04T19:53:31.093Z",
"endTime":"2019-06-04T19:53:31.108Z",
"duration":15219720,
"execution": {
"resolvers": [{
"path": ["__schema"],
"parentType": "Query",
"fieldName": "__schema",
"returnType": "__Schema!",
"startOffset": 50950,
"duration": 17187
}]
}
}
}
}`))
return return
} }

View File

@ -5,7 +5,7 @@
"dependencies": { "dependencies": {
"apollo-link-ws": "^1.0.8", "apollo-link-ws": "^1.0.8",
"graphql": "^14.1.1", "graphql": "^14.1.1",
"graphql-playground-react": "^1.7.20", "@apollographql/graphql-playground-react": "^1.7.26",
"react": "^16.8.3", "react": "^16.8.3",
"react-dom": "^16.8.3", "react-dom": "^16.8.3",
"react-scripts": "2.1.5", "react-scripts": "2.1.5",

View File

@ -1,9 +1,15 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { Playground, store } from 'graphql-playground-react' import { Playground, store } from '@apollographql/graphql-playground-react'
import './index.css' import './index.css'
const fetch = window.fetch
window.fetch = function() {
arguments[1].credentials = 'include'
return Promise.resolve(fetch.apply(global, arguments))
}
class App extends Component { class App extends Component {
render() { render() {
return ( return (
@ -42,13 +48,13 @@ class App extends Component {
<Provider store={store}> <Provider store={store}>
<Playground <Playground
endpoint="/api/v1/graphql" endpoint="/api/v1/graphql"
settings={{ settings="{
"schema.polling.enable": false, 'schema.polling.enable': false,
"request.credentials": "include", 'request.credentials': 'include',
"general.betaUpdates": true, 'general.betaUpdates': true,
"editor.reuseHeaders": true, 'editor.reuseHeaders': true,
"editor.theme": "dark" 'editor.theme': 'dark'
}} }"
/> />
</Provider> </Provider>
</div> </div>

View File

@ -2,6 +2,64 @@
# yarn lockfile v1 # yarn lockfile v1
"@apollographql/graphql-playground-react@^1.7.26":
version "1.7.26"
resolved "https://registry.yarnpkg.com/@apollographql/graphql-playground-react/-/graphql-playground-react-1.7.26.tgz#93b2abe3a117a6e4b0fde479a0fabd9ebda20fdd"
integrity sha512-V8c82pFnyI13FWKeOhiwY7UT4hfi1b+cuWsdbxSVI/lM5iHVpTZaRtsRLAD3wimyay512Jc31VPGSH8LApzHtg==
dependencies:
"@types/lru-cache" "^4.1.1"
apollo-link "^1.0.7"
apollo-link-http "^1.3.2"
apollo-link-ws "1.0.8"
calculate-size "^1.1.1"
codemirror "^5.38.0"
codemirror-graphql timsuchanek/codemirror-graphql#details-fix
copy-to-clipboard "^3.0.8"
cryptiles "4.1.2"
cuid "^1.3.8"
graphiql "^0.11.2"
graphql "^0.11.7"
immutable "^4.0.0-rc.9"
isomorphic-fetch "^2.2.1"
js-yaml "^3.10.0"
json-stable-stringify "^1.0.1"
keycode "^2.1.9"
lodash "^4.17.11"
lodash.debounce "^4.0.8"
markdown-it "^8.4.1"
marked "^0.3.19"
prettier "^1.13.0"
prop-types "^15.6.0"
query-string "5"
react "^16.3.1"
react-addons-shallow-compare "^15.6.2"
react-codemirror "^1.0.0"
react-copy-to-clipboard "^5.0.1"
react-display-name "^0.2.3"
react-dom "^16.3.1"
react-helmet "^5.2.0"
react-input-autosize "^2.2.1"
react-modal "^3.1.11"
react-redux "^5.0.6"
react-router-dom "^4.2.2"
react-sortable-hoc "^0.8.3"
react-transition-group "^2.2.1"
react-virtualized "^9.12.0"
redux "^3.7.2"
redux-actions "^2.2.1"
redux-immutable "^4.0.0"
redux-localstorage rc
redux-localstorage-debounce "^0.1.0"
redux-localstorage-filter "^0.1.1"
redux-saga "^0.16.0"
reselect "^3.0.1"
seamless-immutable "^7.0.1"
styled-components "^4.0.0"
subscriptions-transport-ws "^0.9.5"
utility-types "^1.0.0"
webpack-bundle-analyzer "^2.9.2"
zen-observable "^0.7.1"
"@babel/code-frame@7.0.0", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.0.0-beta.35": "@babel/code-frame@7.0.0", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.0.0-beta.35":
version "7.0.0" version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8"
@ -2503,15 +2561,7 @@ code-point-at@^1.0.0:
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
codemirror-graphql@^0.6.11: codemirror-graphql@^0.6.11, codemirror-graphql@timsuchanek/codemirror-graphql#details-fix:
version "0.6.12"
resolved "https://registry.yarnpkg.com/codemirror-graphql/-/codemirror-graphql-0.6.12.tgz#91a273fe5188857524a30221d06e645b4ca41f00"
integrity sha512-7YP956JubbWkmk9QqKy62CZgdGbEulHNJkz2/aUDTpsE1KrQtRrT9WzStJaxAOEX2k4wUOpojUX2ItPxa69kFA==
dependencies:
graphql-language-service-interface "^1.0.16"
graphql-language-service-parser "^0.1.14"
codemirror-graphql@timsuchanek/codemirror-graphql#details-fix:
version "0.6.12" version "0.6.12"
resolved "https://codeload.github.com/timsuchanek/codemirror-graphql/tar.gz/801ec32683c38d6dc0f8f7bc19014a111edc9ebd" resolved "https://codeload.github.com/timsuchanek/codemirror-graphql/tar.gz/801ec32683c38d6dc0f8f7bc19014a111edc9ebd"
dependencies: dependencies:
@ -4551,7 +4601,7 @@ graphql-import@^0.4.4:
dependencies: dependencies:
lodash "^4.17.4" lodash "^4.17.4"
graphql-language-service-interface@^1.0.16, graphql-language-service-interface@^1.0.18: graphql-language-service-interface@^1.0.18:
version "1.3.2" version "1.3.2"
resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-1.3.2.tgz#4bd5d49e23766c3d2ab65d110f26f10e321cc000" resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-1.3.2.tgz#4bd5d49e23766c3d2ab65d110f26f10e321cc000"
integrity sha512-sOxFV5sBSnYtKIFHtlmAHHVdhok7CRbvCPLcuHvL4Q1RSgKRsPpeHUDKU+yCbmlonOKn/RWEKaYWrUY0Sgv70A== integrity sha512-sOxFV5sBSnYtKIFHtlmAHHVdhok7CRbvCPLcuHvL4Q1RSgKRsPpeHUDKU+yCbmlonOKn/RWEKaYWrUY0Sgv70A==
@ -4561,13 +4611,6 @@ graphql-language-service-interface@^1.0.16, graphql-language-service-interface@^
graphql-language-service-types "^1.2.2" graphql-language-service-types "^1.2.2"
graphql-language-service-utils "^1.2.2" graphql-language-service-utils "^1.2.2"
graphql-language-service-parser@^0.1.14:
version "0.1.14"
resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-0.1.14.tgz#dd25abda5dcff4f2268c9a19e026004271491661"
integrity sha512-72M4OksONeqT5slfdfODmlPBFlUQQkcnRhjgmPt9H2n8/DUcf4XzDkGXudBWpzNfjVU35+IADYW6x13wKw/fOg==
dependencies:
graphql-language-service-types "^0.1.14"
graphql-language-service-parser@^1.0.18, graphql-language-service-parser@^1.2.2: graphql-language-service-parser@^1.0.18, graphql-language-service-parser@^1.2.2:
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.2.2.tgz#010c8a5fdfae4726c8e15714137eee822753d3ea" resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.2.2.tgz#010c8a5fdfae4726c8e15714137eee822753d3ea"
@ -4576,11 +4619,6 @@ graphql-language-service-parser@^1.0.18, graphql-language-service-parser@^1.2.2:
graphql-config "2.0.1" graphql-config "2.0.1"
graphql-language-service-types "^1.2.2" graphql-language-service-types "^1.2.2"
graphql-language-service-types@^0.1.14:
version "0.1.14"
resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-0.1.14.tgz#e6112785fc23ea8222f59a7f00e61b359f263c88"
integrity sha512-77KP83gvK0gWswvGY/+jx/GpsOfKuwWQ1AYnyPT2GDGG3//1QxQTObaZMAEevNTxJtO8T26YXxoUlqkvET7iEg==
graphql-language-service-types@^1.2.2: graphql-language-service-types@^1.2.2:
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-1.2.2.tgz#078e0abc7936a593968c946a039502af136a9743" resolved "https://registry.yarnpkg.com/graphql-language-service-types/-/graphql-language-service-types-1.2.2.tgz#078e0abc7936a593968c946a039502af136a9743"
@ -4596,64 +4634,6 @@ graphql-language-service-utils@^1.2.2:
graphql-config "2.0.1" graphql-config "2.0.1"
graphql-language-service-types "^1.2.2" graphql-language-service-types "^1.2.2"
graphql-playground-react@^1.7.20:
version "1.7.20"
resolved "https://registry.yarnpkg.com/graphql-playground-react/-/graphql-playground-react-1.7.20.tgz#99f27fabbb9b24bb18cce2b62a5324567d7cdfb6"
integrity sha512-0l0z6/D4KhsleX4JKWM/1qiSa+g8s7nmUEn1pj52UmxzqRgDkEequbPEa3zMeeR+k1In89J1i7/YdhHuFNFICQ==
dependencies:
"@types/lru-cache" "^4.1.1"
apollo-link "^1.0.7"
apollo-link-http "^1.3.2"
apollo-link-ws "1.0.8"
calculate-size "^1.1.1"
codemirror "^5.38.0"
codemirror-graphql timsuchanek/codemirror-graphql#details-fix
copy-to-clipboard "^3.0.8"
cryptiles "4.1.2"
cuid "^1.3.8"
graphiql "^0.11.2"
graphql "^0.11.7"
immutable "^4.0.0-rc.9"
isomorphic-fetch "^2.2.1"
js-yaml "^3.10.0"
json-stable-stringify "^1.0.1"
keycode "^2.1.9"
lodash "^4.17.11"
lodash.debounce "^4.0.8"
markdown-it "^8.4.1"
marked "^0.3.19"
prettier "^1.13.0"
prop-types "^15.6.0"
query-string "5"
react "^16.3.1"
react-addons-shallow-compare "^15.6.2"
react-codemirror "^1.0.0"
react-copy-to-clipboard "^5.0.1"
react-display-name "^0.2.3"
react-dom "^16.3.1"
react-helmet "^5.2.0"
react-input-autosize "^2.2.1"
react-modal "^3.1.11"
react-redux "^5.0.6"
react-router-dom "^4.2.2"
react-sortable-hoc "^0.8.3"
react-transition-group "^2.2.1"
react-virtualized "^9.12.0"
redux "^3.7.2"
redux-actions "^2.2.1"
redux-immutable "^4.0.0"
redux-localstorage rc
redux-localstorage-debounce "^0.1.0"
redux-localstorage-filter "^0.1.1"
redux-saga "^0.16.0"
reselect "^3.0.1"
seamless-immutable "^7.0.1"
styled-components "^4.0.0"
subscriptions-transport-ws "^0.9.5"
utility-types "^1.0.0"
webpack-bundle-analyzer "^2.9.2"
zen-observable "^0.7.1"
graphql-request@^1.5.0: graphql-request@^1.5.0:
version "1.8.2" version "1.8.2"
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe" resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe"