You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2022/08/01 11:27:48 UTC
[couchdb-fauxton] 01/01: Fix wrong config section for `enable_cors`
This is an automated email from the ASF dual-hosted git repository.
ronny pushed a commit to branch fix-cors-config-section
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
commit 032866038655ed0970150b906d790990960fb134
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Mon Aug 1 13:22:54 2022 +0200
Fix wrong config section for `enable_cors`
Since CouchDB 3.2 enable_cors moved from section [httpd] to
section [chttpd]. Fixes apache/couchdb-pkg#96
---
app/addons/cors/__tests__/actions.test.js | 2 +-
app/addons/cors/actions.js | 4 ++--
app/addons/cors/api.js | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/addons/cors/__tests__/actions.test.js b/app/addons/cors/__tests__/actions.test.js
index 1ad1034d..2c4d85a6 100644
--- a/app/addons/cors/__tests__/actions.test.js
+++ b/app/addons/cors/__tests__/actions.test.js
@@ -24,7 +24,7 @@ describe('CORS actions', () => {
const localNode = 'node2@127.0.0.1';
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');
diff --git a/app/addons/cors/actions.js b/app/addons/cors/actions.js
index 6fa4b007..4d0805e0 100644
--- a/app/addons/cors/actions.js
+++ b/app/addons/cors/actions.js
@@ -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({
@@ -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));
diff --git a/app/addons/cors/api.js b/app/addons/cors/api.js
index 3d04c60a..704875e9 100644
--- a/app/addons/cors/api.js
+++ b/app/addons/cors/api.js
@@ -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);
@@ -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);