Skip to content

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

@StanislavGoryachev

Description

@StanislavGoryachev

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)\"&"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions