You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
With versions < 2.0 of multipart-post, there's a significant code difference in lib/multipartable.rb that prevents headers for individual parts from being properly parsed when an article is being saved.
NoMethodError: undefined method `strip' for {"metadata"=>{"Content-Type"=>"application/json"}}:Hash
from /Users/ravenstine/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http/header.rb:19:in `block in initialize_http_header'
from /Users/ravenstine/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http/header.rb:17:in `each'
from /Users/ravenstine/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http/header.rb:17:in `initialize_http_header'
from /Users/ravenstine/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http/generic_request.rb:44:in `initialize'
from /Users/ravenstine/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http/request.rb:15:in `initialize'
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/multipart-post-1.2.0/lib/multipartable.rb:11:in `initialize'
from /Users/ravenstine/workspace/apple-news-rb/lib/apple-news/requests/post.rb:29:in `new'
from /Users/ravenstine/workspace/apple-news-rb/lib/apple-news/requests/post.rb:29:in `multipart'
from /Users/ravenstine/workspace/apple-news-rb/lib/apple-news/requests/post.rb:39:in `content_body'
from /Users/ravenstine/workspace/apple-news-rb/lib/apple-news/requests/post.rb:22:in `call'
from /Users/ravenstine/workspace/apple-news-rb/lib/apple-news/article/persistence.rb:14:in `save!'
from (irb):2
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in `start'
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/console.rb:9:in `start'
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/ravenstine/.rvm/gems/ruby-2.3.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'2.3.0 :003 > quit
This could be prevented by only permitting the right version(s) of multipart-post. I'm not sure there is another fix for this because I don't think that attachments to articles work without their own content-type headers.
The text was updated successfully, but these errors were encountered:
Yeah that entire thing was a nightmare. The Apple News API is extremely specific and none of the libraries I tried were able to match the format they needed out of the box. I'm not immediately aware of any good solutions, but am open to any suggestions. If it means writing a multipart lib just for this project, then so be it.
I think it's a perfectly valid solution. It's just that I had to wrestle with my dependencies to try and figure out why that failure was happening, and too many of the gems I'm using depend on older versions of multipart-post. It's more a result of one of the aspects of Ruby dependency management I despise. Apple's crappy "gem" uses rest-client, though I haven't yet tested it with multipart files. It does appear to construct headers for each part, though.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
With versions < 2.0 of multipart-post, there's a significant code difference in
lib/multipartable.rb
that prevents headers for individual parts from being properly parsed when an article is being saved.This could be prevented by only permitting the right version(s) of multipart-post. I'm not sure there is another fix for this because I don't think that attachments to articles work without their own content-type headers.
The text was updated successfully, but these errors were encountered: