ruby-http-session 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '0787793708be50172480874386353726e9c1ea3c84a78dd3850772d8f5e0a5df'
4
+ data.tar.gz: '0519180cc38ad17de9f85cb24758c9e057f6e847868b05203ac4b566eecf9329'
5
+ SHA512:
6
+ metadata.gz: 734e2a67d0719a07fec84366fbb3bdd1417302a38b3c881db1a832870ecb3ade5006419f49041b4e29e55f8c310e4b77b92e824d9fef1815a20f7bb20bf6ac0e
7
+ data.tar.gz: ee8338fc2a6ab4026d41fa9cd8f3e96cb61662d54e5b5c26c9f57df1ca8c9a005989d8529764b5638760723ec8c819e452d13fc24edfd72ec650ec6f6ad385d8
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+ end_of_line = lf
data/.overcommit.yml ADDED
@@ -0,0 +1,36 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/sds/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+
18
+ CommitMsg:
19
+ CapitalizedSubject:
20
+ enabled: false
21
+
22
+ MessageFormat:
23
+ enabled: true
24
+ pattern: '(.+): (.+)'
25
+ expected_pattern_message: '<type>: <description>'
26
+ sample_message: 'feat: Handle cookies'
27
+
28
+ PreCommit:
29
+ RuboCop:
30
+ enabled: true
31
+ command: 'bin/rubocop'
32
+
33
+ PrePush:
34
+ RSpec:
35
+ enabled: true
36
+ command: 'bin/rspec'
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ require: standard
2
+
3
+ inherit_gem:
4
+ standard: config/base.yml
5
+
6
+ AllCops:
7
+ SuggestExtensions: false
8
+ Exclude:
9
+ - 'bin/**/*'
10
+ - 'vendor/**/*'
11
+
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.1
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --markup=markdown
2
+ --markup-provider=redcarpet
3
+ --exclude lib/http-session/webmock.rb
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at johndoe@example.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in http-session.gemspec
6
+ gemspec
7
+
8
+ # optional dependencies
9
+ gem "activesupport", "~> 7.0"
10
+ gem "brotli", platforms: :ruby
11
+
12
+ # rake
13
+ gem "rake", "~> 13.0"
14
+
15
+ # lint
16
+ gem "rubocop", "~> 1.29"
17
+ gem "standard", "~> 1.3"
18
+
19
+ # test
20
+ gem "rspec", "~> 3.0"
21
+ gem "timecop"
22
+ gem "vcr"
23
+ gem "webmock"
24
+
25
+ # doc
26
+ gem "yard", "~> 0.9"
27
+ gem "redcarpet", "~> 3.5", platforms: :ruby
28
+ gem "webrick"
29
+
30
+ # lsp
31
+ gem "solargraph", platforms: :ruby
32
+
33
+ # misc
34
+ gem "overcommit", "~> 0.59"
data/Gemfile.lock ADDED
@@ -0,0 +1,180 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-http-session (1.0.1)
5
+ http (~> 5.1, >= 5.1.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (7.0.8)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ addressable (2.8.5)
16
+ public_suffix (>= 2.0.2, < 6.0)
17
+ ast (2.4.2)
18
+ backport (1.2.0)
19
+ base64 (0.1.1)
20
+ benchmark (0.2.1)
21
+ brotli (0.4.0)
22
+ childprocess (4.1.0)
23
+ concurrent-ruby (1.2.2)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ domain_name (0.5.20190701)
28
+ unf (>= 0.0.5, < 1.0.0)
29
+ e2mmap (0.1.0)
30
+ ffi (1.16.3)
31
+ ffi (1.16.3-java)
32
+ ffi-compiler (1.0.1)
33
+ ffi (>= 1.0.0)
34
+ rake
35
+ hashdiff (1.0.1)
36
+ http (5.1.1)
37
+ addressable (~> 2.8)
38
+ http-cookie (~> 1.0)
39
+ http-form_data (~> 2.2)
40
+ llhttp-ffi (~> 0.4.0)
41
+ http-cookie (1.0.5)
42
+ domain_name (~> 0.5)
43
+ http-form_data (2.3.0)
44
+ i18n (1.14.1)
45
+ concurrent-ruby (~> 1.0)
46
+ iniparse (1.5.0)
47
+ jaro_winkler (1.5.6)
48
+ json (2.6.3)
49
+ json (2.6.3-java)
50
+ kramdown (2.4.0)
51
+ rexml
52
+ kramdown-parser-gfm (1.1.0)
53
+ kramdown (~> 2.0)
54
+ language_server-protocol (3.17.0.3)
55
+ lint_roller (1.1.0)
56
+ llhttp-ffi (0.4.0)
57
+ ffi-compiler (~> 1.0)
58
+ rake (~> 13.0)
59
+ minitest (5.20.0)
60
+ nokogiri (1.15.4-x86_64-linux)
61
+ racc (~> 1.4)
62
+ overcommit (0.60.0)
63
+ childprocess (>= 0.6.3, < 5)
64
+ iniparse (~> 1.4)
65
+ rexml (~> 3.2)
66
+ parallel (1.23.0)
67
+ parser (3.2.2.3)
68
+ ast (~> 2.4.1)
69
+ racc
70
+ public_suffix (5.0.3)
71
+ racc (1.7.1)
72
+ racc (1.7.1-java)
73
+ rainbow (3.1.1)
74
+ rake (13.0.6)
75
+ rbs (2.8.4)
76
+ redcarpet (3.6.0)
77
+ regexp_parser (2.8.1)
78
+ reverse_markdown (2.1.1)
79
+ nokogiri
80
+ rexml (3.2.6)
81
+ rspec (3.12.0)
82
+ rspec-core (~> 3.12.0)
83
+ rspec-expectations (~> 3.12.0)
84
+ rspec-mocks (~> 3.12.0)
85
+ rspec-core (3.12.2)
86
+ rspec-support (~> 3.12.0)
87
+ rspec-expectations (3.12.3)
88
+ diff-lcs (>= 1.2.0, < 2.0)
89
+ rspec-support (~> 3.12.0)
90
+ rspec-mocks (3.12.6)
91
+ diff-lcs (>= 1.2.0, < 2.0)
92
+ rspec-support (~> 3.12.0)
93
+ rspec-support (3.12.1)
94
+ rubocop (1.56.3)
95
+ base64 (~> 0.1.1)
96
+ json (~> 2.3)
97
+ language_server-protocol (>= 3.17.0)
98
+ parallel (~> 1.10)
99
+ parser (>= 3.2.2.3)
100
+ rainbow (>= 2.2.2, < 4.0)
101
+ regexp_parser (>= 1.8, < 3.0)
102
+ rexml (>= 3.2.5, < 4.0)
103
+ rubocop-ast (>= 1.28.1, < 2.0)
104
+ ruby-progressbar (~> 1.7)
105
+ unicode-display_width (>= 2.4.0, < 3.0)
106
+ rubocop-ast (1.29.0)
107
+ parser (>= 3.2.1.0)
108
+ rubocop-performance (1.19.1)
109
+ rubocop (>= 1.7.0, < 2.0)
110
+ rubocop-ast (>= 0.4.0)
111
+ ruby-progressbar (1.13.0)
112
+ solargraph (0.49.0)
113
+ backport (~> 1.2)
114
+ benchmark
115
+ bundler (~> 2.0)
116
+ diff-lcs (~> 1.4)
117
+ e2mmap
118
+ jaro_winkler (~> 1.5)
119
+ kramdown (~> 2.3)
120
+ kramdown-parser-gfm (~> 1.1)
121
+ parser (~> 3.0)
122
+ rbs (~> 2.0)
123
+ reverse_markdown (~> 2.0)
124
+ rubocop (~> 1.38)
125
+ thor (~> 1.0)
126
+ tilt (~> 2.0)
127
+ yard (~> 0.9, >= 0.9.24)
128
+ standard (1.31.1)
129
+ language_server-protocol (~> 3.17.0.2)
130
+ lint_roller (~> 1.0)
131
+ rubocop (~> 1.56.2)
132
+ standard-custom (~> 1.0.0)
133
+ standard-performance (~> 1.2)
134
+ standard-custom (1.0.2)
135
+ lint_roller (~> 1.0)
136
+ rubocop (~> 1.50)
137
+ standard-performance (1.2.0)
138
+ lint_roller (~> 1.1)
139
+ rubocop-performance (~> 1.19.0)
140
+ thor (1.2.2)
141
+ tilt (2.3.0)
142
+ timecop (0.9.8)
143
+ tzinfo (2.0.6)
144
+ concurrent-ruby (~> 1.0)
145
+ unf (0.1.4)
146
+ unf_ext
147
+ unf (0.1.4-java)
148
+ unf_ext (0.0.8.2)
149
+ unicode-display_width (2.4.2)
150
+ vcr (6.2.0)
151
+ webmock (3.19.1)
152
+ addressable (>= 2.8.0)
153
+ crack (>= 0.3.2)
154
+ hashdiff (>= 0.4.0, < 2.0.0)
155
+ webrick (1.8.1)
156
+ yard (0.9.34)
157
+
158
+ PLATFORMS
159
+ universal-java-21
160
+ x86_64-linux
161
+
162
+ DEPENDENCIES
163
+ activesupport (~> 7.0)
164
+ brotli
165
+ overcommit (~> 0.59)
166
+ rake (~> 13.0)
167
+ redcarpet (~> 3.5)
168
+ rspec (~> 3.0)
169
+ rubocop (~> 1.29)
170
+ ruby-http-session!
171
+ solargraph
172
+ standard (~> 1.3)
173
+ timecop
174
+ vcr
175
+ webmock
176
+ webrick
177
+ yard (~> 0.9)
178
+
179
+ BUNDLED WITH
180
+ 2.3.8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 John Doe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # HTTP::Session
2
+
3
+ HTTP::Session - a session abstraction for [http.rb] in order to support **cookies** and **caching**.
4
+
5
+
6
+ ## Quickstart
7
+
8
+ ### Install
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'ruby-http-session', require: "http-session"
14
+ ```
15
+
16
+ ### Cookies
17
+
18
+ The cookies are set automatically each time a request is made:
19
+
20
+ ```ruby
21
+ require "http-session"
22
+
23
+ http = HTTP.session(cookies: true)
24
+ .follow
25
+ .freeze
26
+
27
+ r = http.get("https://httpbin.org/cookies/set/mycookies/abc")
28
+ pp JSON.parse(r.body)["cookies"] # -> {"mycookies"=>"abc"}
29
+
30
+ r = http.get("https://httpbin.org/cookies")
31
+ pp JSON.parse(r.body)["cookies"] # -> {"mycookies"=>"abc"}
32
+
33
+ http.jar.map { |c| pp [c.domain, c.path, c.to_s] } # => ["httpbin.org", "/", "mycookies=abc"]
34
+ ```
35
+
36
+ ### Caching
37
+
38
+ When responses can be reused from a cache, taking into account [HTTP RFC 9111] rules for user agents and
39
+ shared caches. The following headers are used to determine whether the response is cacheable or not:
40
+
41
+ * `Cache-Control` request header
42
+ * `no-store`
43
+ * `no-cache`
44
+ * `Cache-Control` response header
45
+ * `no-store`
46
+ * `no-cache`
47
+ * `private`
48
+ * `public`
49
+ * `max-age`
50
+ * `s-maxage`
51
+ * `Etag` & `Last-Modified` response header for conditional requests
52
+ * `Vary` response header for content negotiation
53
+
54
+ **This takes 60 times to deliver the request to the origin server:**
55
+
56
+ ```ruby
57
+ require "active_support/all"
58
+ require "http"
59
+
60
+ ActiveSupport::Notifications.subscribe('start_request.http') do |name, start, finish, id, payload|
61
+ pp start: start, req: payload[:request].inspect
62
+ end
63
+
64
+ http = HTTP
65
+ .follow
66
+ .timeout(8)
67
+ .use(instrumentation: { instrumenter: ActiveSupport::Notifications.instrumenter })
68
+
69
+ 60.times do
70
+ http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js", headers: {"Accept-Encoding" => ""})
71
+ end
72
+ ```
73
+
74
+ **This only takes 1 time to deliver the request to the origin server:**
75
+
76
+ ```ruby
77
+ require "active_support/all"
78
+ require "http-session"
79
+
80
+ ActiveSupport::Notifications.subscribe('start_request.http') do |name, start, finish, id, payload|
81
+ pp start: start, req: payload[:request].inspect
82
+ end
83
+
84
+ http = HTTP.session(cache: true)
85
+ .follow
86
+ .timeout(8)
87
+ .use(instrumentation: { instrumenter: ActiveSupport::Notifications.instrumenter })
88
+ .freeze
89
+
90
+ 60.times do
91
+ http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js", headers: {"Accept-Encoding" => ""})
92
+ end
93
+ ```
94
+
95
+
96
+ ## Reference
97
+
98
+ ### Caching
99
+
100
+ #### Shared Cache
101
+
102
+ A [shared cache] is a cache that stores responses for **reuse by more than one user**; shared caches
103
+ are usually (but not always) deployed as a part of an intermediary. **This is used by default**.
104
+
105
+ ```ruby
106
+ http = HTTP.session(cache: true) # or HTTP.session(cache: {shared: true})
107
+ .follow
108
+ .timeout(4)
109
+ .use(hsf_auto_inflate: {br: true})
110
+ .freeze
111
+
112
+ res = http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js")
113
+ p "cache-status: #{res.headers["x-httprb-cache-status"]}" # => miss
114
+
115
+ res = http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js")
116
+ p "cache-status: #{res.headers["x-httprb-cache-status"]}" # => hit
117
+
118
+ res = http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js", headers: {"cache-control" => "no-cache"})
119
+ p "cache-status: #{res.headers["x-httprb-cache-status"]}" # => revalidated
120
+
121
+ res = http.get("https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js", headers: {"cache-control" => "no-store"})
122
+ p "cache-status: #{res.headers["x-httprb-cache-status"]}" # => uncacheable
123
+ ```
124
+
125
+ #### Private Cache
126
+
127
+ A [private cache], in contrast, is **dedicated to a single user**; often, they are deployed as a
128
+ component of a user agent.
129
+
130
+ ```ruby
131
+ http = HTTP.session(cache: {private: true})
132
+ .follow
133
+ .timeout(4)
134
+ .use(hsf_auto_inflate: {br: true})
135
+ .freeze
136
+ ```
137
+
138
+ #### Cache Store
139
+
140
+ The default cache store is `ActiveSupport::Cache::MemoryStore`, which resides on the client instance. You
141
+ can use ths `:store` option to set another store, e.g. `ActiveSupport::Cache::MemCacheStore`.
142
+
143
+ ```ruby
144
+ store = ActiveSupport::Cache::MemCacheStore.new("localhost", "server-downstairs.localnetwork:8229")
145
+ http = HTTP.session(cache: {store: store})
146
+ .follow
147
+ .timeout(4)
148
+ .use(hsf_auto_inflate: {br: true})
149
+ .freeze
150
+ ```
151
+
152
+ #### Cache Status
153
+
154
+ The following value is used in the `X-Httprb-Cache-Status` response header:
155
+
156
+ * **HIT**: found in cache
157
+ * **REVALIDATED**: found in cache but stale, revalidated success
158
+ * **EXPIRED**: found in cache but stale, revalidated failure, served from the origin server
159
+ * **MISS**: not found in cache, served from the origin server
160
+ * **UNCACHEABLE**: the request can not use cached response
161
+
162
+ ### HTTP::Features
163
+
164
+ The following features are available with `http-session`:
165
+
166
+ * [logging]: Log requests and responses.
167
+ * [instrumentation]: Instrument requests and responses. Expects an ActiveSupport::Notifications-compatible instrumenter.
168
+ * [hsf_auto_inflate]: Simlar to [auto_inflate], used for automatically decompressing the response body.
169
+ * etc.
170
+
171
+ ### Intergate with WebMock
172
+
173
+ ```ruby
174
+ require "http-session/webmock"
175
+ ```
176
+
177
+
178
+ ## Development
179
+
180
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
181
+
182
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
183
+
184
+
185
+ ## Contributing
186
+
187
+ Bug reports and pull requests are welcome on GitHub at https://github.com/souk4711/http-session. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/souk4711/http-session/blob/main/CODE_OF_CONDUCT.md).
188
+
189
+
190
+ ## License
191
+
192
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
193
+
194
+
195
+ ## Code of Conduct
196
+
197
+ Everyone interacting in the HTTP::Session project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/souk4711/http-session/blob/main/CODE_OF_CONDUCT.md).
198
+
199
+
200
+ [HTTP RFC 9111]:https://datatracker.ietf.org/doc/html/rfc9111/
201
+ [shared cache]:https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#shared_cache
202
+ [private cache]:https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#private_caches
203
+ [http.rb]:https://github.com/httprb/http
204
+ [logging]:https://github.com/httprb/http/wiki/Logging-and-Instrumentation#logging
205
+ [instrumentation]:https://github.com/httprb/http/wiki/Logging-and-Instrumentation#instrumentation
206
+ [auto_inflate]:https://github.com/httprb/http/wiki/Compression#automatic-inflating
207
+ [hsf_auto_inflate]:https://github.com/souk4711/http-session/blob/main/lib/http/session/features/auto_inflate.rb
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/http/session/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ruby-http-session"
7
+ spec.version = HTTP::Session::VERSION
8
+ spec.authors = ["John Doe"]
9
+ spec.email = ["johndoe@example.com"]
10
+
11
+ spec.summary = "HTTP::Session - a session abstraction for http.rb in order to support cookies and caching."
12
+ spec.description = "HTTP::Session - a session abstraction for http.rb in order to support cookies and caching."
13
+ spec.homepage = "https://github.com/souk4711/http-session"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/souk4711/http-session"
19
+ spec.metadata["changelog_uri"] = "https://github.com/souk4711/http-session"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ spec.add_dependency "http", "~> 5.1", ">= 5.1.1"
34
+
35
+ # For more information and examples about making a new gem, check out our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end