Include credentials in simple-json-rpc! when required.

This commit is contained in:
Tony Garnock-Jones 2016-08-02 21:08:03 -04:00
parent ca502bb2ef
commit ce084c25d9

View File

@ -90,7 +90,12 @@
(define request-urls (format "~a~a" baseurl site-relative-url))
(define request-url (string->url request-urls))
(define post-data (string->bytes/utf-8 (jsexpr->string jsexpr-to-send)))
(define raw-response (port->string (post-pure-port request-url post-data)))
(define req-headers
(if include-credentials?
(list (make-basic-auth-credentials-header (session-email s)
(session-password s)))
'()))
(define raw-response (port->string (post-pure-port request-url post-data req-headers)))
(define reply (string->jsexpr raw-response))
(unless sensitive? (log-info "simple-json-rpc: reply ~v" reply))
reply)