[clouchdb-devel] basic-authorization

Knut Olav Bøhmer bohmer at gmail.com
Fri Apr 16 16:53:59 UTC 2010


Hi,

What about enabeling basic-authorization. This worked for me:


(defun db-request (uri &rest args &key &allow-other-keys)
  "Used by most Clouchdb APIs to make the actual REST request."
  (let ((*text-content-types* *text-types*))
    (multiple-value-bind (body status headers uri stream must-close
reason-phrase)
	(apply #'drakma:http-request (make-uri uri)
	       `(, at args :basic-authorization
			,(when (db-user *couchdb*)
			       (list (db-user *couchdb*)
				     (db-password *couchdb*)))))

      ;;(declare (ignore must-close reason-phrase stream uri headers status))
      (when *debug-requests*
        (format t "uri: ~s~%args: ~s~%must-close:~s~%reason-phrase:
        ~s~%status: ~s~%headers: ~s~%stream:~s~%body:~s~%" uri args
        must-close reason-phrase status headers stream body))
      (if (stringp body)
          (json-to-document body)
          (values body status reason-phrase)))))


-- 
Knut Olav Bøhmer




More information about the clouchdb-devel mailing list