You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Michel Legnered (JIRA)" <ji...@apache.org> on 2011/01/09 15:51:45 UTC

[jira] Updated: (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

     [ https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michel Legnered updated COUCHDB-1017:
-------------------------------------

    Description: 
I have this rewrite:
{
	"from": "/u/:key",
	"to": "_list/pouch/user-items",
	"method": "GET",
	"query": {"key": ":key"}
}
..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 JSON"}. The view query looks like this ?key=somekey, but for the view to succeed "somekey" need to be in double quotes.

Maybe one could improve the rewriter's behavior for rewriting strings in queries? 

Here is one workaround:
{
	"from": "/u/:startkey",
	"to": "_list/pouch/user-items",
	"method": "GET",
	"query": {
		"startkey": [":startkey"],
		"endkey": [":startkey", {}]
	}
},

  was:
I have this rewrite:
{
	"from": "/u/:key",
	"to": "_list/pouch/user-items",
	"method": "GET",
	"query": {"key": ":key"}
}
..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 JSON"}. The view query looks like this ?key=somekey, but for the view to succeed "somekey" need to be in double quotes.

Maybe one could improve the rewriter's behavior for rewriting strings in queries? 

Here is one workaround:
{
	"from": "/u/*",
	"to": "_list/pouch/user-items",
	"method": "GET",
	"query": {
		"startkey": ["*"],
		"endkey": ["*", {}]
	}
},


> HTTP Rewrite Handler: Rewriting strings in queries
> --------------------------------------------------
>
>                 Key: COUCHDB-1017
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1017
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.0.1
>            Reporter: Michel Legnered
>            Priority: Minor
>
> I have this rewrite:
> {
> 	"from": "/u/:key",
> 	"to": "_list/pouch/user-items",
> 	"method": "GET",
> 	"query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 JSON"}. The view query looks like this ?key=somekey, but for the view to succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in queries? 
> Here is one workaround:
> {
> 	"from": "/u/:startkey",
> 	"to": "_list/pouch/user-items",
> 	"method": "GET",
> 	"query": {
> 		"startkey": [":startkey"],
> 		"endkey": [":startkey", {}]
> 	}
> },

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.