Fork me on GitHub
#ring-swagger
<
2018-01-16
>
minsunlee04:01:18

hello, i have a question with using text/plain format.

minsunlee04:01:22

[muuntaja.core :as muuntaja] [ring.util.http-response :refer [ok]] [compojure.api.sweet :refer :all] [compojure.route :as route]

minsunlee04:01:47

like that, but i can’t send request as text/plain format

minsunlee04:01:15

with those code, request(as json) is okay

minsunlee04:01:30

if i sent text/plain, response is

minsunlee04:01:21

How can i send my request as text/plain format.

minsunlee04:01:42

something wrong with creating format? or need some options?

ikitommi06:01:07

@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].

ikitommi06:01:06

Still, your body seens nil, so the string doesn't get read. What kind of plain-text request are you sending?

minsunlee06:01:35

if i use that :body [body String]

minsunlee06:01:43

i just use simple string like ‘abcde’

minsunlee06:01:08

is compojure-api always accept json body?

ikitommi06:01:36

@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.

ikitommi06:01:51

e.g. add -H "Content-Type: text/plain"