mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
import: json: Explicitly ask for JSON data.
* guix/import/json.scm (json-fetch): Add #:headers to http-fetch call.
This commit is contained in:
parent
4554813936
commit
81e0bc1834
1 changed files with 2 additions and 1 deletions
|
@ -29,7 +29,8 @@ (define (json-fetch url)
|
||||||
(guard (c ((and (http-get-error? c)
|
(guard (c ((and (http-get-error? c)
|
||||||
(= 404 (http-get-error-code c)))
|
(= 404 (http-get-error-code c)))
|
||||||
#f)) ;"expected" if package is unknown
|
#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))))
|
(result (hash-table->alist (json->scm port))))
|
||||||
(close-port port)
|
(close-port port)
|
||||||
result)))
|
result)))
|
||||||
|
|
Loading…
Reference in a new issue