Added number->status-code.

This commit is contained in:
mainzelm 2003-01-15 13:37:05 +00:00
parent 6a283ab875
commit 06121b3972
2 changed files with 13 additions and 0 deletions

View File

@ -99,6 +99,18 @@
(else (else
(loop (+ i 1))))))) (loop (+ i 1)))))))
(define (number->status-code number)
(if (not (number? number))
(call-error number->status-code (list number))
(let loop ((i 0))
(cond ((= i (vector-length status-codes))
#f)
((= number
(status-code-number (vector-ref status-codes i)))
(vector-ref status-codes i))
(else
(loop (+ i 1)))))))
;;; (make-error-response status-code req [message . extras]) ;;; (make-error-response status-code req [message . extras])
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;

View File

@ -286,6 +286,7 @@
status-code-message status-code-message
(status-code :syntax) (status-code :syntax)
name->status-code name->status-code
number->status-code
make-error-response make-error-response
make-redirect-response make-redirect-response