Skip to content

Instantly share code, notes, and snippets.

@aamedina
Created December 3, 2013 22:12
Show Gist options
  • Select an option

  • Save aamedina/7778485 to your computer and use it in GitHub Desktop.

Select an option

Save aamedina/7778485 to your computer and use it in GitHub Desktop.
(defn GET
"Sends a GET request to the specified URI."
[uri & {:keys [headers] :or {:headers {}}}]
(xhr uri "GET" nil (merge *headers* headers)))
(defn POST
"Sends a POST request to the specified URI with the given payload."
[uri & {:keys [body headers] :or {headers {} body nil}}]
(xhr uri "POST" body (merge *headers* headers)))
(defn PUT
"Sends a PUT request to the specified URI with the given payload."
[uri & {:keys [body headers] :or {headers {} body nil}}]
(xhr uri "PUT" body (merge *headers* headers)))
(defn DELETE
"Sends a DELETE request to the specified URI."
[uri & {:keys [body headers] :or {headers {} body nil}}]
(xhr uri "DELETE" nil (merge *headers* headers)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment