Parse spec url when deciding scheme for operation

This commit is contained in:
Kyle Shockey
2017-04-13 17:26:47 -07:00
parent e33efa1b36
commit 4c1a5488bb
6 changed files with 18063 additions and 14 deletions

View File

@@ -291,7 +291,11 @@ export function operationConsumes(state, pathMethod) {
}
export const operationScheme = ( state, path, method ) => {
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || "http"
let url = state.get("url")
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/)
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "http"
}
export const canExecuteScheme = ( state, path, method ) => {