How to Use: restclient

Setup Link to heading

Add the restclient layer to your .spacemacs:

dotspacemacs-configuration-layers '(
  restclient
)

Secrets Link to heading

Define the following function in your dotspacemacs/user-config:

(defun restclient-envchain-get (namespace variable)
  (cadr
    (split-string
      (string-trim
        (shell-command-to-string
          (format "envchain %s env | grep ^%s=" namespace variable)))
      "=")))

Usage Link to heading

With secrets:

:token := (restclient-envchain-get "secrets" "MY_TOKEN")

GET https://www.codrut.pro/?token=:token

Normal GET:

# ------------------------------------------------------------------------------

GET https://www.codrut.pro/page/endpoint
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

Normal POST:

# ------------------------------------------------------------------------------

POST https://www.codrut.pro/api/endpoint
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Content-Type: application/json

{
  "name": "Codrut",
  "lang": "en"
}