Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryParameters.stale(.OK) returns 400 when used #110

Open
StanislavGoryachev opened this issue Oct 20, 2019 · 0 comments
Open

QueryParameters.stale(.OK) returns 400 when used #110

StanislavGoryachev opened this issue Oct 20, 2019 · 0 comments

Comments

@StanislavGoryachev
Copy link

When I add .stale(.OK) as query parameter I get status code 400 back.
I am using Kitura NIO

There are two things I had to do to fix it:

1 Change to lowercase ok:

/// Indicates when to update.
    public enum StaleOptions {
        /// CouchDB will not refresh the view even if it is stale.
        case ok
        /// CouchDB will update the view after the stale result is returned.
        case updateAfter
    }

instead of case OK

2: Remove \" ... \" from to string switch:

for param in params {
    switch param {
        case .conflicts (let value):
            paramString += "conflicts=\(value)&"

        case .stale (let value):
            paramString += "stale=\(value)&"
        case .startKey (let value):

    }
}

instead of paramString += "stale=\"\(value)\"&"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant