在 html 中,参数如下:
Parameters: {"utf8"=>"✓", "authenticity_token"=>"tLy5M77xdhBr5pyQQsVw43T08THDNQ1z1yDdpC3oM0/jZR/lARPUF8wxNObFa2g/KgtGv5dW/mqDmXCtFmBFSQ==", "post"=>{"title"=>"test text tent"=>"34343", "tag_list"=>"fasd", "skill_list"=>"", "cover"=>#<ActionDispatch::Http::UploadedFile:0x007ff22d2c0688 @tempfile=#<Tempfile:/var/folders/_g/7kks48cd1199yrsgzh965tq00000gn/T/RackMultipart20161011-93895-ub0blw.png>, @original_filename="28_logo.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"post[cover]\"; filename=\"28_logo.png\"\r\nContent-Type: image/png\r\n">, "cover_cache"=>""}, "commit"=>"Update Post", "id"=>"1"}
如果没有文件上传,通过重置客户端使用 json 进行测试将如下所示:
Parameters: {"title"=>"test text ", "id"=>"1", "post"=>{"title"=>test text "}}
问题是,我如何发送带文件的参数以在 Rest Client/postman 工具上使用 ruby on rails restful api?
期望包装格式:
{"title"=>"test text ", "id"=>"1", "post"=>{"title"=>test text ",'cover"=>#<ActionDispatch::Http::UploadedFile.....}}