<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
I would like to enable CORS on my local CouchDB running in a Docker container 
by pressing the corresponding button in the Fauxton UI.

## Current Behavior
When I use the corresponding functionality in the Fauxton UI, I will get an 
error message saying

```
Error! Could not save your CORS settings. Please try again. Reason: invalid 
UTF-8 JSON
```

Inspecting the requests made I can see that a `PUT` request with an empty body 
against `http://localhost:5984/_node/nonode@nohost/_config/cors/origins` is 
being performed that will error out with a 400 status code and the following 
response body:

```
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
```

Weirdly, when I refresh the page after the error has happened I will see that 
CORS has been enabled (it is also working).

## Possible Solution
I would assume that this is due to the empty request body, yet I don't really 
know where and how this is to be fixed.

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1. Create a docker container using the latest version of CouchDB:

```
docker run -d -p 5984:5984 --name fauxton-issue couchdb   
```

2. In your browser, open 
<http://localhost:5984/_utils/#_config/nonode@nohost/cors> and press the button 
saying `Enable CORS`, an error should be displayed
3. Refresh the page in your browser to see that the CORS setting has been 
enabled.

## Your Environment
<!--- Include as many relevant details about the environment you experienced 
the bug in -->
* Version used: 2.2.0
* Browser Name and version: Chrome
* Operating System and version (desktop or mobile): Ubuntu 18.04


[ Full content available at: 
https://github.com/apache/couchdb-fauxton/issues/1130 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to