fix: set default supportedSubmitMethods (#6030)

This commit is contained in:
Brian Wright
2020-06-03 14:40:03 -05:00
committed by GitHub
parent 465b18d282
commit 3b6942c13a

View File

@@ -8,7 +8,7 @@ export default class SwaggerUI extends React.Component {
this.SwaggerUIComponent = null this.SwaggerUIComponent = null
this.system = null this.system = null
} }
componentDidMount() { componentDidMount() {
const ui = swaggerUIConstructor({ const ui = swaggerUIConstructor({
plugins: this.props.plugins, plugins: this.props.plugins,
@@ -27,7 +27,7 @@ export default class SwaggerUI extends React.Component {
this.forceUpdate() this.forceUpdate()
} }
render() { render() {
return this.SwaggerUIComponent ? <this.SwaggerUIComponent /> : null return this.SwaggerUIComponent ? <this.SwaggerUIComponent /> : null
} }
@@ -41,7 +41,7 @@ export default class SwaggerUI extends React.Component {
// update the internal URL // update the internal URL
this.system.specActions.updateUrl(this.props.url) this.system.specActions.updateUrl(this.props.url)
// trigger remote definition fetch // trigger remote definition fetch
this.system.specActions.download(this.props.url) this.system.specActions.download(this.props.url)
} }
} }
@@ -91,3 +91,7 @@ SwaggerUI.propTypes = {
defaultModelExpandDepth: PropTypes.number, defaultModelExpandDepth: PropTypes.number,
plugins: PropTypes.arrayOf(PropTypes.object), plugins: PropTypes.arrayOf(PropTypes.object),
} }
SwaggerUI.defaultProps = {
supportedSubmitMethods: ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'],
}