[PATCH] guix: http tests: Log bad requests.

  • Done
  • quality assurance status badge
Details
One participant
  • Nicolas Graves
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal

Debbugs page

N
N
Nicolas Graves wrote on 9 Apr 04:06 -0700
(address . guix-patches@gnu.org)(address . ngraves@ngraves.fr)
20240409110632.31710-1-ngraves@ngraves.fr
* guix/test/http.scm (call-with-http-server): Log bad requests to make
debugging easier.

Change-Id: I2bb7231db1e5cd9a6e1c4cf76d256fa7c9e50776
---
guix/tests/http.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/tests/http.scm b/guix/tests/http.scm
index 17485df9ef..e02f91923c 100644
--- a/guix/tests/http.scm
+++ b/guix/tests/http.scm
@@ -132,8 +132,10 @@ (define-server-impl stub-http-server
http-write
(@@ (web server http) http-close))
- (define bad-request
- (build-response #:code 400 #:reason-phrase "Unexpected request"))
+ (define (bad-request req)
+ (build-response
+ #:code 400
+ #:reason-phrase (string-append "Unexpected request: " req)))
(define (server-body)
(define (handle request body)
@@ -144,7 +146,7 @@ (define (handle request body)
((((? string?) response data) ...)
(let ((path (uri-path (request-uri request))))
(match (assoc path responses)
- (#f (values bad-request ""))
+ (#f (values (bad-request path) ""))
((_ response data)
(if (eq? 'GET (request-method request))
;; Note: Use 'assoc-remove!' to remove only the first entry
@@ -153,7 +155,7 @@ (define (handle request body)
(let ((rest (assoc-remove! responses path)))
(set! responses rest)
(values response data))
- (values bad-request ""))))))))
+ (values (bad-request path) ""))))))))
(let-values (((socket port) (open-http-server-socket)))
(set! %http-real-server-port port)
--
2.41.0
N
N
Nicolas Graves wrote on 9 Apr 04:14 -0700
close 70308
(address . control@debbugs.gnu.org)
875xwqeqj7.fsf@ngraves.fr
close 70308

--
Best regards,
Nicolas Graves
?
Your comment

This issue is archived.

To comment on this conversation send an email to 70308@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70308
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch