hello, i have a question with using text/plain format.
i use
[muuntaja.core :as muuntaja] [ring.util.http-response :refer [ok]] [compojure.api.sweet :refer :all] [compojure.route :as route]
@minsunlee uploaded a file: https://clojurians.slack.com/files/U06919Z6H/F8TD884LD/-.txt
like that, but i can’t send request as text/plain format
with those code, request(as json) is okay
@minsunlee uploaded a file: https://clojurians.slack.com/files/U06919Z6H/F8SL2A40G/-.txt
if i sent text/plain, response is
@minsunlee uploaded a file: https://clojurians.slack.com/files/U06919Z6H/F8SP1SQQZ/-.clj
How can i send my request as text/plain format.
something wrong with creating format? or need some options?
@minsunlee hi, the :body-params
sets a requirement for a body of map with keys`. To define Schema for the whole body, you can use :body [body String]
.
Still, your body seens nil, so the string doesn't get read. What kind of plain-text request are you sending?
if i use that :body [body String]
@minsunlee uploaded a file: https://clojurians.slack.com/files/U06919Z6H/F8SLK2JAU/-.clj
i just use simple string like ‘abcde’
is compojure-api always accept json body?
@minsunlee I believe curl sets the content-type header to application/x-www-form-urlencoded
by default for POSTs. If you override that to text/plain
it should work.
e.g. add -H "Content-Type: text/plain"