diff --git a/http-easy-lib/http-easy/private/contract.rkt b/http-easy-lib/http-easy/private/contract.rkt index 4a5bdd6..3367039 100644 --- a/http-easy-lib/http-easy/private/contract.rkt +++ b/http-easy-lib/http-easy/private/contract.rkt @@ -18,10 +18,10 @@ (hash/c symbol? (or/c bytes? string?))) (define form-data/c - (listof (cons/c symbol? (or/c false/c string?)))) + (listof (cons/c symbol? (or/c #f string?)))) (define query-params/c - (listof (cons/c symbol? (or/c false/c string?)))) + (listof (cons/c symbol? (or/c #f string?)))) (define auth-procedure/c (-> url? headers/c query-params/c (values headers/c query-params/c))) diff --git a/http-easy-lib/http-easy/private/payload.rkt b/http-easy-lib/http-easy/private/payload.rkt index 54047c5..29ebbcc 100644 --- a/http-easy-lib/http-easy/private/payload.rkt +++ b/http-easy-lib/http-easy/private/payload.rkt @@ -55,11 +55,8 @@ (lambda (in out) (gzip-through-ports in out #f (current-seconds)))))) -(define (json-payload v) - (lambda (hs) - (values - (hash-set hs 'content-type #"application/json; charset=utf-8") - (jsexpr->bytes v)))) +(define ((json-payload v) hs) + (values (hash-set hs 'content-type #"application/json; charset=utf-8") (jsexpr->bytes v))) (define ((pure-payload v) hs) (values hs v)) diff --git a/http-easy-lib/http-easy/private/pool.rkt b/http-easy-lib/http-easy/private/pool.rkt index bb0caa9..ca0a2f4 100644 --- a/http-easy-lib/http-easy/private/pool.rkt +++ b/http-easy-lib/http-easy/private/pool.rkt @@ -1,8 +1,8 @@ #lang racket/base -(require (prefix-in d: data/pool) - net/http-client +(require net/http-client racket/contract/base + (prefix-in d: data/pool) "error.rkt" "logger.rkt" "timeout.rkt") diff --git a/http-easy-lib/http-easy/private/session.rkt b/http-easy-lib/http-easy/private/session.rkt index 276e51d..4367177 100644 --- a/http-easy-lib/http-easy/private/session.rkt +++ b/http-easy-lib/http-easy/private/session.rkt @@ -259,7 +259,7 @@ [(301 302 303) 'get] [(307) method]) #:headers (hash-remove headers 'authorization) - #:auth (if (same-origin? dest-url u) auth #f) + #:auth (and (same-origin? dest-url u) auth) #:history (cons resp history) #:redirects (sub1 redirects-remaining)))] diff --git a/http-easy-lib/http-easy/private/timeout.rkt b/http-easy-lib/http-easy/private/timeout.rkt index aabd70e..8d0516c 100644 --- a/http-easy-lib/http-easy/private/timeout.rkt +++ b/http-easy-lib/http-easy/private/timeout.rkt @@ -17,7 +17,7 @@ [make-request-timeout-evt (-> timeout-config? evt?)])) (define timeout/c - (or/c false/c (and/c real? positive?))) + (or/c #f (and/c real? positive?))) (struct timeout-config (lease connect request) #:transparent) diff --git a/http-easy-lib/http-easy/private/url.rkt b/http-easy-lib/http-easy/private/url.rkt index 773d083..f6d031a 100644 --- a/http-easy-lib/http-easy/private/url.rkt +++ b/http-easy-lib/http-easy/private/url.rkt @@ -126,7 +126,7 @@ (define (is-percent-encoded? s [encode uri-encode]) (define num-%-matches (length (regexp-match* #rx"%" s))) - (or (and (> num-%-matches 0) + (or (and (positive? num-%-matches) (= num-%-matches (length (regexp-match* #px"%[a-fA-F0-9]{2}" s)))) (and (eq? encode form-urlencoded-encode) (regexp-match? #rx"[+]" s))))