feat(swagger-ui-react): Add withCredentials prop (#7980)
Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
@@ -158,6 +158,12 @@ If set, it persists authorization data and it would not be lost on browser close
|
||||
|
||||
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
|
||||
|
||||
#### `withCredentials`: PropTypes.bool
|
||||
|
||||
If set to `true`, enables passing credentials, [as defined in the Fetch standard](https://fetch.spec.whatwg.org/#credentials), in CORS requests that are sent by the browser. Note that Swagger UI cannot currently set cookies cross-domain (see [swagger-js#1163](https://github.com/swagger-api/swagger-js/issues/1163)) - as a result, you will have to rely on browser-supplied cookies (which this setting enables sending) that Swagger UI cannot control.
|
||||
|
||||
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
|
||||
|
||||
## Limitations
|
||||
|
||||
* Not all configuration bindings are available.
|
||||
|
||||
@@ -35,6 +35,7 @@ export default class SwaggerUI extends React.Component {
|
||||
showExtensions: this.props.showExtensions,
|
||||
filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false,
|
||||
persistAuthorization: this.props.persistAuthorization,
|
||||
withCredentials: this.props.withCredentials,
|
||||
})
|
||||
|
||||
this.system = ui
|
||||
@@ -129,6 +130,7 @@ SwaggerUI.propTypes = {
|
||||
tryItOutEnabled: PropTypes.bool,
|
||||
displayRequestDuration: PropTypes.bool,
|
||||
persistAuthorization: PropTypes.bool,
|
||||
withCredentials: PropTypes.bool,
|
||||
}
|
||||
|
||||
SwaggerUI.defaultProps = {
|
||||
|
||||
Reference in New Issue
Block a user