Skip to content

Commit f774cd0

Browse files
committed
enhdebug mode
1 parent 9590e20 commit f774cd0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

private/core.rkt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@
8080

8181
(when (current-http-client/debug)
8282
(define (fmt h)
83-
(string-join (map (lambda (e) (~a (car e) ": " (cdr e))) (hash->list h)) "\n"))
84-
(printf "METHOD ~a \n" (http-request-method req))
85-
(printf "URL ~a \n" (http-request-url req))
86-
(printf "HEADERS ~a \n" (fmt (http-request-headers req)))
87-
(printf "DATA ~a \n\n" (fmt (http-request-data req)))
83+
(string-join (map (lambda (e) (~a " " (car e) ": " (cdr e))) (hash->list h)) "\n"))
84+
(printf "METHOD: ~a\n" (http-request-method req))
85+
(printf "URL: ~a\n" (http-request-url req))
86+
(printf "HEADERS: \n~a\n" (fmt (http-request-headers req)))
87+
(printf "DATA: \n~a\n\n" (fmt (http-request-data req)))
8888
)
8989

9090
(define-values (res-status-raw res-headers-raw res-in)
@@ -119,12 +119,11 @@
119119
[(hash-table ('Content-Type (regexp #rx"^(application/xml|text/xml|application/xhtml+xml).*")))
120120
(string->xexpr res-body-raw)]
121121
[_ res-body-raw]))
122-
123122
(when (current-http-client/debug)
124123
(define (fmt h)
125-
(string-join (map (lambda (e) (~a (car e) ": " (cdr e))) (hash->list h)) "\n"))
126-
(printf "RESPONSE CODE ~a \n" res-code)
127-
(printf "RESPONSE HEADERS ~a \n" (fmt res-headers))
128-
(printf "RESPNOSE BODY ~a \n\n\n\n" res-body-raw)
124+
(string-join (map (lambda (e) (~a " " (car e) ": " (cdr e))) (hash->list h)) "\n"))
125+
(printf "RESPONSE CODE: ~a\n" res-code)
126+
(printf "RESPONSE HEADERS: \n~a\n" (fmt res-headers))
127+
(printf "RESPNOSE BODY: \n~a\n\n\n\n" res-body-raw)
129128
)
130129
(http-response req res-code res-headers res-body))

0 commit comments

Comments
 (0)