Default headers
This commit is contained in:
parent
84553cf750
commit
ce2976e37f
4
Makefile
4
Makefile
|
@ -7,14 +7,14 @@ all: .setup
|
|||
test: .setup
|
||||
raco test -p smol-http
|
||||
|
||||
run: all
|
||||
run:
|
||||
ifndef FB_USERNAME
|
||||
$(error "Provide FB_USERNAME variable")
|
||||
endif
|
||||
ifndef FB_PASSWORD
|
||||
$(error "Provide FB_PASSWORD variable")
|
||||
endif
|
||||
./webcrawler $(USERNAME) $(PASSWORD)
|
||||
./webcrawler $(FB_USERNAME) $(FB_PASSWORD)
|
||||
|
||||
.setup:
|
||||
raco pkg install smol-http/
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
(define (->bytes x)
|
||||
(if (bytes? x)
|
||||
x
|
||||
(string->bytes/latin-1 (format "~a" x))))
|
||||
(string->bytes/utf-8 (format "~a" x))))
|
||||
|
||||
(module+ test
|
||||
(let ([b #"hello"]) (check-eq? (->bytes b) b))
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
; vim: ft=racket
|
||||
(require smol-http)
|
||||
|
||||
(define DEFAULT-HDRS '((user-agent . "🦈 hash-lang-uwu crawler v1.0")
|
||||
;; christo pls do not track thanks
|
||||
(dnt . "1")))
|
||||
|
||||
(define req
|
||||
(make-http-req 'GET "/hello-world"))
|
||||
(make-http-req 'GET "/hello-world" DEFAULT-HDRS))
|
||||
|
||||
(define (run-webcrawler username password)
|
||||
(printf "the credentials are: ~s ~s\n" username password)
|
||||
|
|
Loading…
Reference in New Issue