Fork me on GitHub

Hi everybody. I generated swagger with help of reitit. Usually body params it’s json but for some routes it should be just text/html. So, I don’t understand how I change expected content type of payload for route.I tried to do something like this:

:headers      {"Content-Type" "text/html"}
          :parameters {:query {:test string?}
                       :body  string?}
but it doesn’t work. In swagger UI I always can see Parameter content type: application/json


I use the following interceptors



@y.khmelevskii if you just need to hint the swagger-ui, you can put :swagger {:produces ["text/plain"]} into route data. All data under :swagger is merged to the swagger spec.


for the actual endpoint, add :headers {"Content-Type" "text/html"} to the response map


thank you @ikitommi! I need to set content type for request body, not response. But it’s work

:data   {:swagger      {:consumes ["application/json" "text/plain"]}
if you can suggest how I can do it for the actual endpoint, it would be great.


you could add a new format to Muuntaja (see for text/plain or just remove the body parameter requirement and parse the request body in an handler or middleware yourself. You should be able to slurp the body and get the string out.


I see, thank you. Going to read muunaja doc