GetView - Need HTTP POST instead of HTTP GET


#1

When executing a call extremely similar to the one below I receive the error “Invalid URI: The Uri string is too long”.

Code snippet:

CouchbaseClient client;
client.GetView<SomeDataModel>("DesignName", "ViewName", true)
            .Stale(StaleMode.False)
            .Reduce(true)
            .StartKey<object[]>(["someString", 0, "", "", "", 0, ""])
            .EndKey<object[]>(["someString", 9999, "zzzzzzzzzzzzzzzzzzzz", "zzzzzzzzzzzzzzzzzzzz", "zzzzzzzzzzzzzzzzzzzz", 999999999, "zzzzzzzzzzzzzzzzzzzz"]);

If I remove the Start Key and End Key limiters the view will successfully return so I presume that an HTTP GET is being performed and the length of the keys are causing the issue. I used 20 "z"s to represent how long the data could be. For a literal end when there isn’t a value specified of course “{” would work, but when values are specified for the strings could be 20 characters long, or possibly even longer.


Is there any way to force the view call to be a HTTP POST instead of a HTTP GET since I want to allow a pretty wide range of values?

I checked for other similar requests and only found one match here, but unfortunately it looks like the OP never received a response.


#2

Indeed. Above a certain size we need to convert it to an HTTP POST. This sounds like an issue. Which version are you using?

@jmorris can you confirm and is there an issue to be tracked?

A workaround for now would be to do the POST just using any old HTTP client, but this should work out of the box.


#3

@ingenthr this is the 1.X client. Ticket created here: http://www.couchbase.com/issues/browse/NCBC-686

I am really surprised that the max URI string size is being hit here, given that this is relatively small query; I’ll need to debug through to see what exactly is going on.

-Jeff