add http method "options"

This commit is contained in:
Tobias Grelsson 2015-02-18 23:35:01 +01:00 committed by Matthew Flatt
parent be6e1a4045
commit a5d506a3a4

View File

@ -634,6 +634,14 @@
(define (put-impure-port url put-data [strings '()]) (define (put-impure-port url put-data [strings '()])
(method-impure-port 'put url put-data strings)) (method-impure-port 'put url put-data strings))
;; options-pure-port : url [x list (str)] -> in-port
(define (options-pure-port url [strings '()])
(method-pure-port 'options url #f strings))
;; options-impure-port : url [x list (str)] -> in-port
(define (options-impure-port url [strings '()])
(method-impure-port 'options url #f strings))
;; method-impure-port : symbol x url x list (str) -> in-port ;; method-impure-port : symbol x url x list (str) -> in-port
(define (method-impure-port method url data strings) (define (method-impure-port method url data strings)
(let ([scheme (url-scheme url)]) (let ([scheme (url-scheme url)])
@ -662,7 +670,7 @@
(define (http://method-impure-port method url data strings) (define (http://method-impure-port method url data strings)
(let* ([method (case method (let* ([method (case method
[(get) "GET"] [(post) "POST"] [(head) "HEAD"] [(get) "GET"] [(post) "POST"] [(head) "HEAD"]
[(put) "PUT"] [(delete) "DELETE"] [(put) "PUT"] [(delete) "DELETE"] [(options) "OPTIONS"]
[else (url-error "unsupported method: ~a" method)])] [else (url-error "unsupported method: ~a" method)])]
[proxy (assoc (url-scheme url) (current-proxy-servers))] [proxy (assoc (url-scheme url) (current-proxy-servers))]
[hc (make-ports url proxy)] [hc (make-ports url proxy)]
@ -717,6 +725,8 @@
(delete-impure-port (->* (url?) ((listof string?)) input-port?)) (delete-impure-port (->* (url?) ((listof string?)) input-port?))
(put-pure-port (->* (url? (or/c false/c bytes?)) ((listof string?)) input-port?)) (put-pure-port (->* (url? (or/c false/c bytes?)) ((listof string?)) input-port?))
(put-impure-port (->* (url? bytes?) ((listof string?)) input-port?)) (put-impure-port (->* (url? bytes?) ((listof string?)) input-port?))
(options-pure-port (->* (url?) ((listof string?)) input-port?))
(options-impure-port (->* (url?) ((listof string?)) input-port?))
(display-pure-port (input-port? . -> . void?)) (display-pure-port (input-port? . -> . void?))
(purify-port (input-port? . -> . string?)) (purify-port (input-port? . -> . string?))
(get-pure-port/headers (->* (url?) (get-pure-port/headers (->* (url?)