faraday-encoding 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4c08097d709f28419abcac3be4d573f06e2f358e
4
- data.tar.gz: ce236543376016d34318c07019ab61191c2348cf
2
+ SHA256:
3
+ metadata.gz: b81c8ee628ff9ecdf09fe773916a5a730ff445fabc37b0036860b3c56d64db11
4
+ data.tar.gz: 982d1c9f2e4b4e5b2955361dce742c69b5500f0bf51c5855fb69f481f977c118
5
5
  SHA512:
6
- metadata.gz: 6ea363605b9a79ce76e34c6d402b3eb2661373f8f5e5b6e2783993fa6a0ae814d2f5011d5e32e8fbfa33a4f9e1e163271654d9bec3c89ca0117bfe906d587b29
7
- data.tar.gz: e15e65e2b85961fdf54087eaf5fafafc5cde7c2339e222ecdb0533c408cb549465a44aad356d459cf81716f8270f59280b6b4916cd0127170d6ddb909058c52a
6
+ metadata.gz: 5fda32ac5631299869711cfcdf0a38b39d5dc5eb98a207977818dc039ee8197708af9554212c9112641fb20cdb0f8b034829643b7b3020a356bcb884305d5121
7
+ data.tar.gz: 60231d81a6e89395711d845a491454592538485ccc2645b98a8e053560b5510042664c8b655532979b0ab3d6cd780c819915a2e8336cc011392728f6672ffe48
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+
15
+ jobs:
16
+ test:
17
+
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby
26
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
27
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
32
+ - name: Run tests
33
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Faraday::Encoding
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/faraday-encoding.svg)](http://badge.fury.io/rb/faraday-encoding)
4
- [![Build Status](https://travis-ci.org/ma2gedev/faraday-encoding.svg)](https://travis-ci.org/ma2gedev/faraday-encoding)
4
+ [![Build Status](https://github.com/ma2gedev/faraday-encoding/workflows/Ruby/badge.svg?branch=master)](https://github.com/ma2gedev/faraday-encoding/actions?query=workflow%3ARuby)
5
5
 
6
6
  A Faraday Middleware sets body encoding when specified by server.
7
7
 
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "faraday-encoding"
7
- spec.version = "0.0.4"
7
+ spec.version = "0.0.6"
8
8
  spec.authors = ["Takayuki Matsubara"]
9
- spec.email = ["takayuki.1229@m3.com"]
9
+ spec.email = ["takayuki.1229@gmail.com"]
10
10
  spec.summary = %q{A Faraday Middleware sets body encoding when specified by server.}
11
11
  spec.description = %q{A Faraday Middleware sets body encoding when specified by server.}
12
- spec.homepage = ""
12
+ spec.homepage = "https://github.com/ma2gedev/faraday-encoding"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
@@ -17,8 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.7"
21
- spec.add_development_dependency "rake", "~> 10.0"
20
+ spec.add_development_dependency "rake", ">= 0"
22
21
  spec.add_development_dependency "rspec"
23
22
  spec.add_development_dependency 'faraday_middleware', '~> 0.10'
24
23
 
@@ -12,7 +12,8 @@ module Faraday
12
12
  @app.call(environment).on_complete do |env|
13
13
  @env = env
14
14
  if encoding = content_charset
15
- env[:body].force_encoding(encoding)
15
+ env[:body] = env[:body].dup if env[:body].frozen?
16
+ env[:body].force_encoding(encoding) if !env[:body].nil?
16
17
  end
17
18
  end
18
19
  end
@@ -17,6 +17,9 @@ describe Faraday::Encoding do
17
17
  stub.get('/redirected') do
18
18
  [redirected_status, redirected_headers, redirected_body]
19
19
  end
20
+ stub.post('/post') do
21
+ [post_response_status, post_response_headers, post_response_body]
22
+ end
20
23
  end
21
24
  end
22
25
 
@@ -39,6 +42,20 @@ describe Faraday::Encoding do
39
42
  end
40
43
  end
41
44
 
45
+ context 'deal correctly with frozen strings' do
46
+ let(:response_encoding) do
47
+ 'utf-8'
48
+ end
49
+ let(:response_body) do
50
+ 'abc'.force_encoding(Encoding::ASCII_8BIT).freeze
51
+ end
52
+
53
+ it 'set encoding to utf-8' do
54
+ response = client.get('/')
55
+ expect(response.body.encoding).to eq(Encoding::UTF_8)
56
+ end
57
+ end
58
+
42
59
  context 'deal correctly with a non standard encoding names' do
43
60
  context 'utf8' do
44
61
  let(:response_encoding) do
@@ -95,4 +112,18 @@ describe Faraday::Encoding do
95
112
  expect(response.body.encoding).to eq(Encoding::ASCII_8BIT)
96
113
  end
97
114
  end
115
+
116
+ context 'ignore with an empty body' do
117
+ let(:post_response_status) { 204 }
118
+ let(:post_response_headers) do
119
+ { 'content-type' => "text/plain; charset=utf-8" }
120
+ end
121
+ let(:post_response_body) do
122
+ nil
123
+ end
124
+
125
+ it 'skips `force_encoding`' do
126
+ expect { client.post('/post') }.not_to raise_error
127
+ end
128
+ end
98
129
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-encoding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takayuki Matsubara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.7'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.7'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - "~>"
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '10.0'
19
+ version: '0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - "~>"
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -82,13 +68,13 @@ dependencies:
82
68
  version: '0'
83
69
  description: A Faraday Middleware sets body encoding when specified by server.
84
70
  email:
85
- - takayuki.1229@m3.com
71
+ - takayuki.1229@gmail.com
86
72
  executables: []
87
73
  extensions: []
88
74
  extra_rdoc_files: []
89
75
  files:
76
+ - ".github/workflows/ruby.yml"
90
77
  - ".gitignore"
91
- - ".travis.yml"
92
78
  - Gemfile
93
79
  - LICENSE.txt
94
80
  - README.md
@@ -98,11 +84,11 @@ files:
98
84
  - lib/faraday/encoding.rb
99
85
  - spec/faraday/encoding_spec.rb
100
86
  - spec/spec_helper.rb
101
- homepage: ''
87
+ homepage: https://github.com/ma2gedev/faraday-encoding
102
88
  licenses:
103
89
  - MIT
104
90
  metadata: {}
105
- post_install_message:
91
+ post_install_message:
106
92
  rdoc_options: []
107
93
  require_paths:
108
94
  - lib
@@ -117,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.5.1
122
- signing_key:
106
+ rubygems_version: 3.5.3
107
+ signing_key:
123
108
  specification_version: 4
124
109
  summary: A Faraday Middleware sets body encoding when specified by server.
125
110
  test_files:
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.8
4
- - 2.2.4
5
- - 2.3.0
6
- sudo: false
7
- cache: bundler