Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong config section for enable_cors #1362

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/addons/cors/__tests__/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('CORS actions', () => {
const localNode = '[email protected]';
const baseURL = 'http://localhost:8000/#_config/couchdb@localhost/cors';
const dispatch = sinon.stub();
const spyUpdateEnableCorsToHttpd = sinon.stub(CorsAPI, 'updateEnableCorsToHttpd');
const spyUpdateEnableCorsToHttpd = sinon.stub(CorsAPI, 'updateEnableCorsToChttpd');
const spyUpdateCorsOrigins = sinon.stub(CorsAPI, 'updateCorsOrigins');
const spyUpdateCorsCredentials = sinon.stub(CorsAPI, 'updateCorsCredentials');
const spyUpdateCorsHeaders = sinon.stub(CorsAPI, 'updateCorsHeaders');
Expand Down
4 changes: 2 additions & 2 deletions app/addons/cors/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as CorsAPI from "./api";

const fetchAndLoadCORSOptions = (url, node) => (dispatch) => {
const fetchCors = CorsAPI.fetchCORSConfig(url);
const fetchHttp = CorsAPI.fetchHttpdConfig(url);
const fetchHttp = CorsAPI.fetchChttpdConfig(url);

FauxtonAPI.Promise.join(fetchCors, fetchHttp, (corsConfig, httpdConfig) => {
const loadOptions = loadCORSOptions({
Expand Down Expand Up @@ -71,7 +71,7 @@ const hideDomainDeleteConfirmation = () => {
const saveCors = (url, options) => (dispatch) => {
const promises = [];

promises.push(CorsAPI.updateEnableCorsToHttpd(url, options.node, options.corsEnabled));
promises.push(CorsAPI.updateEnableCorsToChttpd(url, options.node, options.corsEnabled));
if (options.corsEnabled) {
promises.push(CorsAPI.updateCorsOrigins(url, options.node, sanitizeOrigins(options.origins)));
promises.push(CorsAPI.updateCorsCredentials(url, options.node));
Expand Down
8 changes: 4 additions & 4 deletions app/addons/cors/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const fetchCORSConfig = (baseURL) => {
});
};

export const fetchHttpdConfig = (baseURL) => {
const configURL = baseURL + '/httpd';
export const fetchChttpdConfig = (baseURL) => {
const configURL = baseURL + '/chttpd';
return get(configURL).then((json) => {
if (json.error) {
throw new Error(json.reason);
Expand All @@ -39,11 +39,11 @@ export const fetchHttpdConfig = (baseURL) => {
});
};

export const updateEnableCorsToHttpd = (baseURL, node, enableCors) => {
export const updateEnableCorsToChttpd = (baseURL, node, enableCors) => {
if (!node) {
throw new Error('node not set');
}
const configURL = baseURL + '/httpd/enable_cors';
const configURL = baseURL + '/chttpd/enable_cors';
return put(configURL, enableCors.toString()) .then((json) => {
if (json.error) {
throw new Error(json.reason);
Expand Down