-
-
Save Kungi/3bbba631378de17cf08d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--ABC | |
Content-Disposition: form-data; name="file"; filename="a.txt" | |
Content-Type: text/plain | |
A | |
--ABC | |
Content-Disposition: form-data; name="description" | |
test_description | |
--ABC | |
Content-Disposition: form-data; name="name" | |
test_name | |
--ABC-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Content-type: multipart/form-data; boundary=--ABC" --data-binary @a.txt http://localhost:3000/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns multipart-upload.handler | |
(:require [clojure.pprint :refer [pprint]] [compojure.core :refer :all] | |
[compojure.route :as route] | |
[ring.middleware.defaults :refer [wrap-defaults api-defaults]])) | |
(defroutes app-routes | |
(GET "/" [] "Hello World") | |
(POST "/" [] "Hello World") | |
(route/not-found "Not Found")) | |
(defn log-request [handler] | |
(fn [req] | |
(pprint req) | |
(handler req))) | |
(def app | |
(wrap-defaults (log-request app-routes) (-> api-defaults | |
(assoc-in [:params :multipart] true) | |
(assoc-in [:params :nested] true)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:ssl-client-cert nil, | |
:remote-addr "0:0:0:0:0:0:0:1", | |
:params {}, | |
:headers | |
{"host" "localhost:3000", | |
"accept" "*/*", | |
"content-length" "241", | |
"content-type" "multipart/form-data; boundary=--ABC", | |
"user-agent" "curl/7.37.1"}, | |
:server-port 3000, | |
:content-length 241, | |
:form-params {}, | |
:query-params {}, | |
:content-type "multipart/form-data; boundary=--ABC", | |
:character-encoding nil, | |
:uri "/", | |
:server-name "localhost", | |
:query-string nil, | |
:body | |
#object[org.eclipse.jetty.server.HttpInput 0x5f435901 "org.eclipse.jetty.server.HttpInput@5f435901"], | |
:multipart-params {}, | |
:scheme :http, | |
:request-method :post} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment