silk icon indicating copy to clipboard operation
silk copied to clipboard

Support for multipart multipart/form-data and file upload

Open mantishK opened this issue 10 years ago • 7 comments

Support multipart data and uploading file as a form parameter in POST and PUT methods. There can be a folder that contains all the files that will be uploaded while testing, this path can be set as an argument while running silk. The names of the file mentioned in the markdown could be relative to this folder. We can add a comment after the field that the filed is a file field and it's value is a file path.

name: Mat
CV: CV/mat-cv.pdf // file

mantishK avatar Feb 19 '16 13:02 mantishK

I think a link to the file will be good.

[field_name](/path/to/file)
  • field_name - the name of the field to update with
  • /path/to/file - the path to the file to upload

How does that sound? It means that, when rendered, the user could even preview the file.

matryer avatar Feb 21 '16 21:02 matryer

It means that the files to be uploaded while testing will have to be in a repo/server and the files need to be public. This may not always be the case, correct? Also, while testing, silk will download each file and then upload them. It may consume a lot of time if there are too many files/tests. It would be great if we keep the link and have some way of overriding the base path that contains the files to be uploaded. Your thoughts?

mantishK avatar Feb 22 '16 04:02 mantishK

Silk runs locally (so far) so the files would be nearby, I think they would only get uploaded, and probably to a local server. I think selective test running will help people avoid long-running tests, as would have to be the case anyway.

matryer avatar Feb 22 '16 21:02 matryer

If we are giving local file path, then there are no issues as far as the working of silk is considered. Wouldn't it be hard to share the test docs to others? By hard, I mean, due to local path, the links may not open on other machines.

mantishK avatar Feb 23 '16 07:02 mantishK

I'm thinking you'd have this:

/tests
  /files
    image1.png
  /silk
    thumbnails.silk.md
      (would mention `../files/image1.png`)

So the files would go alongside the test files. For bigger files, a script to download the files into the correct place might be sensible, but out of scope of Silk.

How does that sound?

matryer avatar Feb 23 '16 21:02 matryer

Sounds good.

mantishK avatar Feb 24 '16 04:02 mantishK

I don't know Go at all but I can test a branch and provide some feedback once the feature is implemented given that I'll need it for a project.

davidbgk avatar Mar 14 '16 09:03 davidbgk