Method: JSONModel::HTTP.post_json_file
- Defined in:
- lib/aspace_client/jsonmodel_client.rb
.post_json_file(url, path, &block) ⇒ Object
252 253 254 255 256 257 258 259 260 261 |
# File 'lib/aspace_client/jsonmodel_client.rb', line 252 def self.post_json_file(url, path, &block) File.open(path) do |fh| req = Net::HTTP::Post.new(url.request_uri) req['Content-Type'] = 'text/json' req['Content-Length'] = File.size(path) req.body_stream = fh do_http_request(url, req, &block) end end |