-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpcli.spad
55 lines (45 loc) · 1.66 KB
/
httpcli.spad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
)abbrev package HTTPCLI HttpClient
++ Author: Kurt Pagani <nilqed@gmail.com>
++ Date Created: Mon Nov 30 18:54:58 CET 2015
++ Date Revised: Fri Apr 03 01:03:34 CET 2021
++ License: BSD
++ Date Last Updated:
++ Basic Operations:
++ Depends On: DRAKMA/HTPP-REQUEST
++ Examples:
++ References:
++ https://edicl.github.io/drakma/
++ Description:
++ cl-drakma/bionic,bionic 2.0.3-1 all
++ Common Lisp HTTP client
++ sudo apt install cl-drakma
++ Test 'require':
++ rlwrap sbcl
++ * (require :asdf)
++ * (require :drakma)
++ Notes:
++ Only 'low level' is implemented at the moment.
++ For more sophisticated requests, consult the reference
++ above.
HttpClient() : Exports == Implementation where
STR ==> String
SEX ==> SExpression
MSC ==> MoreSystemCommands
syscmd(s) ==> systemCommand(s)$MSC
lisp1(s) ==> syscmd(string(FORMAT('NIL,"lisp ~A",s)$Lisp))
Exports == with
GET : STR -> SEX
++ Sends an HTTP request to a web server and returns its reply. Uri is
++ where the request is sent to, and it is either a string denoting a
++ uniform resource identifier or a PURI:URI object. The scheme of uri
++ must be 'http' or 'https'.
POST : (STR,STR) -> SEX
++ sends an HTTP request to a web server using "method:post" and returns
++ its reply.
Implementation == add
lisp1 "(require :asdf)"
lisp1 "(require :drakma)"
lisp1 "(defun |drakmaGET| (a) (drakma:http-request a))"
lisp1 "(defun |drakmaPOST| (a c) (drakma:http-request a :method :post :content c))"
GET(url:STR):SEX == drakmaGET(url)$Lisp
POST(url:STR,content:STR):SEX == drakmaPOST(url,content)$Lisp