Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-16964

"creds" array fails with HTTP POST with JSON encoding, but not with URL encoding

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 4.5.0
    • 4.1.0
    • query
    • Security Level: Public
    • None
    • Untriaged
    • Unknown

    Description

      You can do a GET and pass the "creds" array to the server and it will work as expected, however if you do a POST and include the "creds" array in the request body, you will recieve the following error:

      HTTP/1.1 400 Bad Request
      Content-Length: 396
      Content-Type: application/json; version=1.0.0
      Date: Thu, 03 Dec 2015 19:58:55 GMT
       
      {
          "requestID": "66a9e5c6-59b1-479e-a3e7-57133e5fcaa4",
          "errors": [
              {
                  "code": 1070,
                  "msg": "creds has to be of type array of { user, pass }"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "5.935122ms",
              "executionTime": "5.934642ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      

      Here is an example of a GET (which succeeds):

      curl -v http://10.141.111.101:8093/query/service -d 'statement=SELECT sum(c1) FROM authenticated;&creds=[{"user":"local:authenticated","pass":"secret"}]
      

      Here is an example of a POST (which fails):

      curl -H "Content-Type: application/json" -X POST -d '{"statement":"SELECT sum(c1) FROM authenticated;","timeout":"75000ms","creds":[{"user":"local:authenticated","pass":"secret"}]
      

      Attachments

        Activity

          People

            johan.larson Johan Larson (Inactive)
            jmorris Jeff Morris
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty