Fork me on GitHub
#pedestal
<
2022-08-22
>
dangercoder19:08:14

does anyone have a version of io.pedestal.test/response-for laying around which lets you pass in a context? else I’ll build one 😄

souenzzo21:08:14

@UBN9SNVB4 the idea of response-for is to call your application as it curl was calling it

souenzzo21:08:42

if you implement this feature, response-for will be equivalent to simply call the function handler/the interceptor chain

souenzzo21:08:18

why you can't pass (response-for ... :body (t/write-str {:username ...}))

souenzzo21:08:33

and :headers {"my-session" "...."}

dangercoder05:08:37

Hi thanks for the answer @U2J4FRT2T, I had another thought about it and I agree it just calls the interceptor chain, but there is value in testing the “whole chain” with the routes etc. The problem here is session really, the user is expected to have a session. I could make it so that I attach an interceptor which adds a session when I’m in test mode. Then I could still use response-for without any changes

rolt10:08:30

how do you expect the end user to pass the session ? it has to be through http related fields, cookies or headers anyway. Or do you want to mock this ? Note: the routes are part of the interceptor chain