CouchDB; PUT Update Through URL Return: "Invalid UTF-8 JSON"

I can update my documents only with:

/_design/test/_update/user/dbf805bece7d468c4782fffaa5018680

but when I try to do it through

/_design/test/_rewrite/user/dbf805bece7d468c4782fffaa5018680

using this rewrite script:

{
           "from": ":type/:key",
           "to": "_update/:type/:key",
           "method": "PUT"
},

I get an error message:

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

The json I went with is all right; the same json works when I don't go through _rewrite, and I can also insert the same json using the rewriten URL using POST.

EDIT: Change: the key to * helped me fix this ... but is that the right solution?

+3
source share
1 answer

I had the same problem and found that quoting the request key corrects it.

For instance:

/_design/test/_rewrite/user/"dbf805bece7d468c4782fffaa5018680"

But in my case, I use a method GET.

+2

All Articles