ring

alice 2017-11-01T03:29:57.000049Z

Right now I'm having this weird issue, I have a POST endpoint /api/upload and if I send a request with curl it gets handled like 4 times curl -X POST -H "content-type: multipart/form-data" 127.0.0.1:3000/api/upload -F "key=lol" -F "image=@xyz.png" debug print: http://shekels.wtf/i/7d2b8f6cd894.meme.png

2017-11-01T04:38:03.000041Z

@alice Can you provide some code?

alice 2017-11-01T07:17:47.000056Z

What would you need to see? @weavejester

alice 2017-11-01T07:17:52.000168Z

I wouldn't know what to send

alice 2017-11-01T07:18:02.000155Z

as far as I know the whole implementation is very standard

alice 2017-11-01T07:18:08.000153Z

and I wouldn't wanna spam the entire project here

alice 2017-11-01T07:55:38.000073Z

Alright, using my besst judgement I guess it's really just two functions

alice 2017-11-01T07:55:46.000016Z

(context "/api" []
           (POST "/upload" {params :params} (upload params)))

alice 2017-11-01T07:56:15.000165Z

(defn upload [request]
    (println "thing called"))

alice 2017-11-01T07:56:19.000224Z

and it'll print twice

alice 2017-11-01T07:59:20.000111Z

Yeah, upload is ONLY referenced in that bit there

alice 2017-11-01T07:59:25.000076Z

it always prints two times

alice 2017-11-01T07:59:40.000008Z

the request is only handled once afaik but the route wants to happen twice

2017-11-01T14:22:31.000221Z

@alice It might be related to the lack of an explicit return value. println returns nil, and in Compojure, a return value of nil from a route means “this route didn’t match, try the next one”. Try returning a valid response from the route and see if that fixes it.