Browse files

Only parse response to lxml if content-type is application/xml.

Change-Id: I462d6c0e69181dda883db58c42db065534a2edad
Reviewed-by: Ahmon Dancy <>
Reviewed-by: John O'Rourke <>
Tested-by: Kevin Layer <>
  • Loading branch information...
Mikel Bancroft authored and dklayer committed Jun 14, 2013
1 parent 8cf04fa commit 5a68fa0a8f0a56a210f946740ceea8e1e66b0010
Showing with 10 additions and 5 deletions.
  1. +10 −5 solr.lisp
@@ -345,11 +345,16 @@ query by :rows parameter:
;; Parse response
(defun parse-response (body status headers)
- (let ((lxml (let ((*package* (find-package :keyword))) (parse-xml body))))
- (when (not (eql status 200))
- (error 'solr-error :status-code status :response-headers headers
- :response-body lxml))
- lxml))
+ (destructuring-bind ((param content-type &optional charset))
+ (net.aserve::parse-header-value (cdr (assoc :content-type headers)))
+ (declare (ignore param charset))
+ (let ((lxml (if* (string-equal content-type "application/xml")
+ then (let ((*package* (find-package :keyword))) (parse-xml body))
+ else body)))
+ (when (not (eql status 200))
+ (error 'solr-error :status-code status :response-headers headers
+ :response-body lxml))
+ lxml)))
;; Some Solr POST message can take optional parameters via url query string.
;; We can't use :query argument of do-http-request, for we have to use

0 comments on commit 5a68fa0

Please sign in to comment.