;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (test-http-client) #:use-module (guix http-client) #:use-module (guix tests http) #:use-module (srfi srfi-1) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64) #:use-module (rnrs bytevectors) #:use-module (rnrs io ports) #:use-module (web response) #:use-module (web uri)) (test-begin "http-client") (test-equal "http-fetch, one request, binary" (string->utf8 "Hello, world.") (with-http-server `((200 "Hello, world.")) (let* ((port (http-fetch (%local-url))) (bv (get-bytevector-all port))) (close-port port) bv))) (test-equal "http-fetch, one request, text" "Hello, world." (with-http-server `((200 "Hello, world.")) (let* ((port (http-fetch (%local-url) #:text? #t)) (data (get-string-all port))) (close-port port) data))) (test-equal "http-fetch, redirect" "Hello, world." (with-http-server `((,(build-response #:code 301 #:headers `((location . ,(string->uri-reference "/elsewhere"))) #:reason-phrase "Moved") "Redirect!") (200 "Hello, world.")) (let* ((port (http-fetch (%local-url))) (data (get-string-all port))) (close-port port) data))) (test-equal "http-fetch, error" 404 (with-http-server `((404 "Ne trovita.")) (guard (c ((http-get-error? c) (http-get-error-code c))) (http-fetch (%local-url)) #f))) (test-equal "http-fetch, redirect + error" 403 (with-http-server `((,(build-response #:code 302 #:headers `((location . ,(string->uri-reference "/elsewhere"))) #:reason-phrase "Moved") "Redirect!") (403 "Verboten.")) (guard (c ((http-get-error? c) (http-get-error-code c))) (http-fetch (%local-url)) #f))) (test-end "http-client") ommit/gnu/services/configuration.scm?id=46fee48d5c89bcffdf759645484e063ada2d97c0'>services: configuration: Fix typo....Maxim Cournoyer 2022-08-25services: configuration: Change the value of the unset marker....Attila Lendvai 2022-08-24services: configuration: Add maybe-value exported procedure....Attila Lendvai 2022-08-24services: configuration: Add %unset-value exported variable....Attila Lendvai 2022-08-24services: configuration: Add a 'maybe-value-set?' procedure....Maxim Cournoyer 2022-08-01services: configuration: Step back from *unspecified*....Maxim Cournoyer 2022-06-24services: configuration: Remove 'validate-configuration'....Ludovic Courtès 2022-06-24services: configuration: Report the location of field type errors....Ludovic Courtès 2022-06-15services: configuration: Use *unspecified* instead of 'disabled....Attila Lendvai 2022-06-15services: configuration: Support (field1 maybe-number "") format....Attila Lendvai 2021-11-01services: configuration: Fix interpose implementation....Andrew Tropin 2021-10-09home: services: configuration: Support file-like objects....Oleg Pykhalov 2021-08-02services: configuration: Derive the default value from the package variable....Xinglu Chen 2021-08-02services: configuration: Uniformize the generated documentation....Xinglu Chen