import: json: Explicitly ask for JSON data.
authorFederico Beffa <beffa@fbengineering.ch>
Sun, 5 Feb 2017 13:42:10 +0000 (14:42 +0100)
committerFederico Beffa <beffa@fbengineering.ch>
Thu, 9 Feb 2017 18:36:04 +0000 (19:36 +0100)
* guix/import/json.scm (json-fetch): Add #:headers to http-fetch call.

guix/import/json.scm

index 5940f5e..c76bc93 100644 (file)
@@ -29,7 +29,8 @@
   (guard (c ((and (http-get-error? c)
                   (= 404 (http-get-error-code c)))
              #f))                       ;"expected" if package is unknown
-    (let* ((port (http-fetch url))
+    (let* ((port (http-fetch url #:headers '((user-agent . "GNU Guile")
+                                             (Accept . "application/json"))))
            (result (hash-table->alist (json->scm port))))
       (close-port port)
       result)))