Fork me on GitHub
#ring
<
2017-11-01
>
alice03:11:57

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 "[email protected]" debug print: http://shekels.wtf/i/7d2b8f6cd894.meme.png

weavejester04:11:03

@alice Can you provide some code?

alice07:11:47

What would you need to see? @weavejester

alice07:11:52

I wouldn't know what to send

alice07:11:02

as far as I know the whole implementation is very standard

alice07:11:08

and I wouldn't wanna spam the entire project here

alice07:11:38

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

alice07:11:46

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

alice07:11:15

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

alice07:11:19

and it'll print twice

alice07:11:20

Yeah, upload is ONLY referenced in that bit there

alice07:11:25

it always prints two times

alice07:11:40

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

weavejester14:11:31

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