Skip to content

Commit

Permalink
std/net/request: align args on http-*
Browse files Browse the repository at this point in the history
make http-* take the same args list
(http-get, http-delete, http-options)
  • Loading branch information
ovh-irobot committed Mar 12, 2021
1 parent d857b7b commit 2bc526a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/std/net/request.ss
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,28 @@
(cons (cons key value) headers))))))
(foldr fold-e headers new-headers))


(def (http-get url
redirect: (redirect #t)
headers: (headers #f)
cookies: (cookies #f)
params: (params #f)
data: (data #f)
auth: (auth #f))
(let ((url (url-target-e url params))
(headers (make-http/1.1-headers headers cookies auth)))
(http-request 'GET url headers #f [] redirect)))
(http-request 'GET url headers data [] redirect)))

(def (http-head url
redirect: (redirect #t)
headers: (headers #f)
cookies: (cookies #f)
params: (params #f)
data: (data #f)
auth: (auth #f))
(let ((url (url-target-e url params))
(headers (make-http/1.1-headers headers cookies auth)))
(http-request 'HEAD url headers #f [] redirect)))
(http-request 'HEAD url headers data [] redirect)))

(def (http-post url
redirect: (redirect #t)
Expand Down Expand Up @@ -162,19 +165,22 @@
headers: (headers #f)
cookies: (cookies #f)
params: (params #f)
data: (data #f)
auth: (auth #f))
(let ((url (url-target-e url params))
(headers (make-http/1.1-headers headers cookies auth)))
(http-request 'DELETE url headers #f [] redirect)))
(http-request 'DELETE url headers data [] redirect)))

(def (http-options url
redirect: (redirect #t)
headers: (headers #f)
cookies: (cookies #f)
params: (params #f)
data: (data #f)
auth: (auth #f))
(let ((url (url-target-e url params))
(headers (make-http/1.1-headers headers cookies auth)))
(http-request 'HEAD url headers #f [] #f)))
(http-request 'OPTIONS url headers data [] redirect)))

(def url-rx
(pregexp "(?:(https?)://)?([^/:]+)(:[0-9]+)?(/.*)?"))
Expand Down

0 comments on commit 2bc526a

Please sign in to comment.