main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
665 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.makeFetchJSON = makeFetchJSON;
|
---|
5 | var _constants = require("../../constants.js");
|
---|
6 | // eslint-disable-next-line import/prefer-default-export
|
---|
7 | function makeFetchJSON(http, opts = {}) {
|
---|
8 | const {
|
---|
9 | requestInterceptor,
|
---|
10 | responseInterceptor
|
---|
11 | } = opts;
|
---|
12 | // Set credentials with 'http.withCredentials' value
|
---|
13 | const credentials = http.withCredentials ? 'include' : 'same-origin';
|
---|
14 | return docPath => http({
|
---|
15 | url: docPath,
|
---|
16 | loadSpec: true,
|
---|
17 | requestInterceptor,
|
---|
18 | responseInterceptor,
|
---|
19 | headers: {
|
---|
20 | Accept: _constants.ACCEPT_HEADER_VALUE_FOR_DOCUMENTS
|
---|
21 | },
|
---|
22 | credentials
|
---|
23 | }).then(res => res.body);
|
---|
24 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.