سؤال

I have a problem with liberator body-as-string function and line-seq.

(println
    (line-seq
        (BufferedReader. (StringReader. (body-as-string ctx)))
    )
)

With this curl command the function return (h1,h2\nh3,h4\nh5,h6) instead of (h1,h2 h3,h4 h5,h6)

curl "localhost:3000/log" -X POST -H "Content-type:text/csv" -d "h1,h2\nh3,h4\nh5,h6"

EDIT :

I add body-as-string function :

(defn body-as-string
"Parcours le contexte de la requête pour en extraire le body"
[ctx]

    (timbre/debug "body-as-string")

    (if-let
        [body (get-in ctx [:request :body])]
        (condp instance? body
            java.lang.String body
            (slurp (io/reader body))
        )
    )

)

Maybe is it an encoding problem ?

Thank you !

هل كانت مفيدة؟

المحلول

Your shell is probably not actually sending a newline, check this question (and its answers): How to send line break with curl?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top