Fork me on GitHub
#pedestal
<
2020-02-24
>
Ho0man10:02:23

Hi, everyone I don't know how I could write a test for the part of out API (that is implemented in pedestal) that accepts a file and uses Ring multi-part interceptor ? (Can I use the pedestal.test/response-for here the same way I used it for body params and such ? How should I construct the request and how should I feed the file to response-for ?) It will be great if anyone could help me Thanks in advance

ddeaguiar23:02:29

@UU0F762AU, that’s a great question. Yes you can. I’ve added a sample of how you’d construct the request to the cookbook documentation (http://pedestal.io/cookbook/index#_how_to_test_your_servlet_based_service). I’ve pasted the relevant bits above.

mh.meraji11:02:07

Hi Thank you for your answer I have another issue about this subject How can we add also a simple key value near my file in the request body? Thank you for your time.

ddeaguiar22:02:16

@UBZ3VLMKJ it’s just a matter of adding additional fields wrapped by the boundary. The fields in the above sample do no need to be files

Ho0man11:02:55

@U0FL657GR Sorry another question, here you have sent a string file. But I want to send xlsx files. Can I use the same method for sending ?

Ho0man11:02:58

Thanks again