Pass configuration interceptors to spec download fetch
This commit is contained in:
@@ -7,13 +7,16 @@ export default function downloadUrlPlugin (toolbox) {
|
|||||||
let { fn } = toolbox
|
let { fn } = toolbox
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
download: (url)=> ({ errActions, specSelectors, specActions }) => {
|
download: (url)=> ({ errActions, specSelectors, specActions, getConfigs }) => {
|
||||||
let { fetch } = fn
|
let { fetch } = fn
|
||||||
|
const config = getConfigs()
|
||||||
url = url || specSelectors.url()
|
url = url || specSelectors.url()
|
||||||
specActions.updateLoadingStatus("loading")
|
specActions.updateLoadingStatus("loading")
|
||||||
fetch({
|
fetch({
|
||||||
url,
|
url,
|
||||||
loadSpec: true,
|
loadSpec: true,
|
||||||
|
requestInterceptor: config.requestInterceptor || (a => a),
|
||||||
|
responseInterceptor: config.responseInterceptor || (a => a),
|
||||||
credentials: "same-origin",
|
credentials: "same-origin",
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "application/json,*/*"
|
"Accept": "application/json,*/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user