web-response-header-code-type
This commit is contained in:
parent
2d1ad8a62d
commit
c9eddfa0b7
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
(rename-out [web-response-header <web-response-header>])
|
(rename-out [web-response-header <web-response-header>])
|
||||||
(struct-out/defaults [make-web-response-header web-response-header])
|
(struct-out/defaults [make-web-response-header web-response-header])
|
||||||
|
web-response-header-code-type
|
||||||
(struct-out web-response-complete)
|
(struct-out web-response-complete)
|
||||||
(struct-out web-response-chunked)
|
(struct-out web-response-chunked)
|
||||||
(rename-out [web-response-websocket <web-response-websocket>])
|
(rename-out [web-response-websocket <web-response-websocket>])
|
||||||
|
@ -80,6 +81,18 @@
|
||||||
(define-struct-defaults make-web-response-websocket web-response-websocket
|
(define-struct-defaults make-web-response-websocket web-response-websocket
|
||||||
(#:headers [web-response-websocket-headers '()])))
|
(#:headers [web-response-websocket-headers '()])))
|
||||||
|
|
||||||
|
(define (web-response-header-code-type rh)
|
||||||
|
(if (not rh) ;; network failure of some kind; respondent did not respond
|
||||||
|
'network-failure
|
||||||
|
(let ((code (web-response-header-code rh)))
|
||||||
|
(cond
|
||||||
|
[(<= 100 code 199) 'informational]
|
||||||
|
[(<= 200 code 299) 'successful]
|
||||||
|
[(<= 300 code 399) 'redirection]
|
||||||
|
[(<= 400 code 499) 'client-error]
|
||||||
|
[(<= 500 code 599) 'server-error]
|
||||||
|
[else 'other]))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Ground-level communication messages
|
;; Ground-level communication messages
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue