Skip to content

Commit

Permalink
Merge pull request #7 from ursm/mime
Browse files Browse the repository at this point in the history
Switch from Mercel to MiniMime
  • Loading branch information
ursm committed Jul 7, 2024
2 parents adf2a6c + 0bed802 commit 8c4c4ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
fetch-api (0.3.3)
marcel
mini_mime
net-http
rack
singleton
Expand All @@ -12,7 +12,7 @@ GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.1)
marcel (1.0.4)
mini_mime (1.1.5)
net-http (0.4.1)
uri
rack (3.1.6)
Expand Down
2 changes: 1 addition & 1 deletion fetch-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { File.basename(_1) }
spec.require_paths = ['lib']

spec.add_dependency 'marcel'
spec.add_dependency 'mini_mime'
spec.add_dependency 'net-http'
spec.add_dependency 'rack'
spec.add_dependency 'singleton'
Expand Down
4 changes: 2 additions & 2 deletions lib/fetch/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative 'response'
require_relative 'url_search_params'

require 'marcel'
require 'mini_mime'
require 'net/http'
require 'singleton'
require 'uri'
Expand All @@ -27,7 +27,7 @@ def fetch(resource, method: :get, headers: [], body: nil, redirect: :follow, _re
if v.is_a?(File)
[k, v, {
filename: File.basename(v.path),
content_type: Marcel::MimeType.for(name: v.path)
content_type: MiniMime.lookup_by_filename(v.path)&.content_type || 'application/octet-stream'
}]
else
[k, v]
Expand Down

0 comments on commit 8c4c4ff

Please sign in to comment.