metosin / compojure-api

Sweet web apis with Compojure & Swagger
http://metosin.github.io/compojure-api/doc/
Eclipse Public License 1.0
1.11k stars 149 forks source link

Mixing compojure.api.sweet/defapi and compojure.core/defroutes #459

Open maksr opened 1 year ago

maksr commented 1 year ago

Library Version(s)

[metosin/compojure-api "1.1.13"] [compojure "1.6.1"]

Problem

I have two handlers, defined as

(compojure.api.sweet/defapi restful-routes...) (compojure.core/defroutes public-routes...)

When I combine them with

(compojure.core/routes #'restful-routes #'public-routes)

the POST requests to public routes loose :body parameters. The body comes through as org.eclipse.jetty.server.HttpInputOverHTTP, but it has been read somwhere in the middleware so its content is not available.

I blame compojure.api.sweet for this, because when I reverse the call order to

(compojure.core/routes #'public-routes #'restful-routes)

it works fine, the body streams in POST methods are available in both handlers.