带有厨师http_request资源的多部分POST [英] multipart POST with Chef http_request resource
本文介绍了带有厨师http_request资源的多部分POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用Chef http_request资源进行多篇文章?我有类似以下内容的文件内容,但是我需要将表格数据一起发布.
Is there a way to do a multipart post with the Chef http_request resource? I have something like the following which posts the file contents, but I need to post form data along with it.
http_request 'post_file_and_form_data' do
headers ({'Content-Type' => 'multipart/form-data'})
url "http://myhost:2000/myapp/upload"
action :post
message lazy { ::File.read("/somewhere/myFile.yaml") }
end
推荐答案
我不确定底层Ruby标准库(Net::HTTP
)是否支持此功能.我已经看到大多数需要使用 multipart-post gem 的实现.我建议您安装它并在您的食谱中使用它,也许在Ruby块中使用.
I'm not sure this is supported in the underlying Ruby standard library (Net::HTTP
). I've seen most implementations that need this end up using the multipart-post gem. I'd suggest installing that and using it in your recipe, perhaps in a Ruby block.
这篇关于带有厨师http_request资源的多部分POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文