Infer contextUrl through documentation scheme + host if spec url is relative

This commit is contained in:
Kyle Shockey
2017-04-07 20:51:07 -07:00
parent 5f9efc09cb
commit e2b1757f8f
6 changed files with 50 additions and 44 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAsdA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA27FA;AAuwGA;AAilFA;AAikFA;AAs9CA;AA8jDA;AA2qCA;AA4tEA;AAgkIA;;;;;;;;;;;;;;AAw4GA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAi9BA;;;;;;AAqtEA;AA+zFA;;;;;AA23CA;AA2qFA;AAq2CA;AA0kCA;AAs/CA;AA0wEA;AA49FA;;;;;;;;;AA20BA;AA2zIA;AAi4DA;AA6tDA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAsdA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA27FA;AAuwGA;AAulFA;AAikFA;AAs9CA;AA8jDA;AA2qCA;AAq+EA;AAm4HA;;;;;;;;;;;;;;AAo1HA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAi9BA;;;;;;AAqtEA;AA+zFA;;;;;AA23CA;AA2qFA;AAq2CA;AA0kCA;AAs/CA;AA0wEA;AA49FA;;;;;;;;;AA20BA;AA2zIA;AAi4DA;AA6tDA","sourceRoot":""}

18
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAmwCA;AAoyHA;AA2wHA;AA07FA;AA+nCA;AAohCA;AAghCA;AAk4BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAmwCA;AAoyHA;AAgxHA;AAg8FA;AA4nCA;AAghCA;AA0gCA;AAw4BA","sourceRoot":""}

View File

@@ -68,6 +68,7 @@
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.0.4",
"url-parse": "^1.1.8",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",
"xml": "1.0.1",

View File

@@ -1,4 +1,5 @@
import YAML from "js-yaml"
import parseUrl from "url-parse"
import serializeError from "serialize-error"
// Actions conform to FSA (flux-standard-actions)
@@ -186,7 +187,11 @@ export const logRequest = (req) => {
// (For debugging) and ease of testing
export const executeRequest = (req) => ({fn, specActions, specSelectors}) => {
let { pathName, method } = req
let parsedRequest = Object.assign({ contextUrl: specSelectors.url() }, req)
// if url is relative, parseUrl makes it absolute by inferring from `window.location`
let specUrl = parseUrl(specSelectors.url())
let parsedRequest = Object.assign({ contextUrl: specUrl.toString() }, req)
if ( pathName && method ) {
parsedRequest.operationId = method.toLowerCase() + "-" + pathName
}