mirror of
https://github.com/lostisland/faraday.git
synced 2025-07-27 00:01:55 -04:00
Compare commits
6 Commits
9487833b42
...
074506e67c
Author | SHA1 | Date | |
---|---|---|---|
|
074506e67c | ||
|
898f203584 | ||
|
f0f549d7ef | ||
|
caa4ff42f8 | ||
|
13732f7ff2 | ||
|
8cbfd758c2 |
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -24,10 +24,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Ruby 2.7
|
||||
- name: Setup Ruby 3.x
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
ruby-version: 3
|
||||
bundler-cache: true
|
||||
|
||||
- name: Rubocop
|
||||
@ -43,7 +43,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ruby: [ '2.6', '2.7', '3.0', '3.1', '3.2' ]
|
||||
ruby: [ '3.0', '3.1', '3.2', '3.3' ]
|
||||
experimental: [false]
|
||||
include:
|
||||
- ruby: head
|
||||
@ -63,7 +63,6 @@ jobs:
|
||||
run: bundle exec rake
|
||||
|
||||
- name: Test External Adapters
|
||||
if: ${{ matrix.ruby != '2.6' }}
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
run: bundle exec bake test:external
|
||||
|
||||
|
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@ -14,10 +14,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Ruby 2.7
|
||||
- name: Setup Ruby 3.x
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
ruby-version: 3
|
||||
|
||||
- name: Publish to RubyGems
|
||||
uses: dawidd6/action-publish-gem@v1
|
||||
|
@ -7,7 +7,7 @@ require:
|
||||
AllCops:
|
||||
DisplayCopNames: true
|
||||
DisplayStyleGuide: true
|
||||
TargetRubyVersion: 2.6
|
||||
TargetRubyVersion: 3.0
|
||||
|
||||
# Custom config
|
||||
Gemspec/RequireMFA: # we don't know if this works with auto-deployments yet
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2022-08-08 14:26:32 UTC using RuboCop version 1.33.0.
|
||||
# on 2023-12-27 11:12:52 UTC using RuboCop version 1.59.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
@ -23,23 +23,23 @@ Lint/EmptyBlock:
|
||||
- 'spec/faraday/rack_builder_spec.rb'
|
||||
- 'spec/faraday/response_spec.rb'
|
||||
|
||||
# Offense count: 12
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
||||
# Offense count: 13
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 42
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 3
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 230
|
||||
Max: 225
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 13
|
||||
|
||||
# Offense count: 26
|
||||
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# Offense count: 27
|
||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
||||
Metrics/MethodLength:
|
||||
Max: 33
|
||||
|
||||
@ -48,11 +48,22 @@ Metrics/MethodLength:
|
||||
Metrics/ParameterLists:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
|
||||
# Offense count: 7
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 14
|
||||
|
||||
# Offense count: 19
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
|
||||
# RedundantRestArgumentNames: args, arguments
|
||||
# RedundantKeywordRestArgumentNames: kwargs, options, opts
|
||||
# RedundantBlockArgumentNames: blk, block, proc
|
||||
Style/ArgumentsForwarding:
|
||||
Exclude:
|
||||
- 'lib/faraday.rb'
|
||||
- 'lib/faraday/rack_builder.rb'
|
||||
|
||||
# Offense count: 3
|
||||
Style/DocumentDynamicEvalDefinition:
|
||||
Exclude:
|
||||
|
@ -35,7 +35,7 @@ Need more details? See the [Faraday API Documentation][apidoc] to see how it wor
|
||||
This library aims to support and is [tested against][actions] the currently officially supported Ruby
|
||||
implementations. This means that, even without a major release, we could add or drop support for Ruby versions,
|
||||
following their [EOL](https://endoflife.date/ruby).
|
||||
Currently that means we support Ruby 2.6+
|
||||
Currently that means we support Ruby 3.0+
|
||||
|
||||
If something doesn't work on one of these Ruby versions, it's a bug.
|
||||
|
||||
|
@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
||||
spec.homepage = 'https://lostisland.github.io/faraday'
|
||||
spec.licenses = ['MIT']
|
||||
|
||||
spec.required_ruby_version = '>= 2.6'
|
||||
spec.required_ruby_version = '>= 3.0'
|
||||
|
||||
# faraday-net_http is the "default adapter", but being a Faraday dependency it can't
|
||||
# control which version of faraday it will be pulled from.
|
||||
@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
||||
# This way, we can release minor versions of the adapter with "breaking" changes for older versions of Faraday
|
||||
# and then bump the version requirement on the next compatible version of faraday.
|
||||
spec.add_dependency 'faraday-net_http', '>= 2.0', '< 3.1'
|
||||
spec.add_dependency 'ruby2_keywords', '>= 0.0.4'
|
||||
|
||||
# Includes `examples` and `spec` to allow external adapter gems to run Faraday unit and integration tests
|
||||
spec.files = Dir['CHANGELOG.md', '{examples,lib,spec}/**/*', 'LICENSE.md', 'Rakefile', 'README.md']
|
||||
|
@ -15,7 +15,7 @@ module Faraday
|
||||
class Connection
|
||||
# A Set of allowed HTTP verbs.
|
||||
METHODS = Set.new %i[get post put delete head patch options trace]
|
||||
USER_AGENT = "Faraday v#{VERSION}"
|
||||
USER_AGENT = "Faraday v#{VERSION}".freeze
|
||||
|
||||
# @return [Hash] URI query unencoded key/value pairs.
|
||||
attr_reader :params
|
||||
|
@ -102,7 +102,7 @@ module Faraday
|
||||
|
||||
protected
|
||||
|
||||
SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/.freeze
|
||||
SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/
|
||||
|
||||
def decode_pair(key, value, context)
|
||||
subkeys = key.scan(SUBKEYS_REGEX)
|
||||
|
@ -60,7 +60,7 @@ module Faraday
|
||||
:reason_phrase, :response_body) do
|
||||
const_set(:ContentLength, 'Content-Length')
|
||||
const_set(:StatusesWithoutBody, Set.new([204, 304]))
|
||||
const_set(:SuccessfulStatuses, (200..299).freeze)
|
||||
const_set(:SuccessfulStatuses, (200..299))
|
||||
|
||||
# A Set of HTTP verbs that typically send a body. If no body is set for
|
||||
# these requests, the Content-Length header is set to 0.
|
||||
|
@ -1,6 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'ruby2_keywords'
|
||||
require 'faraday/adapter_registry'
|
||||
|
||||
module Faraday
|
||||
|
@ -13,7 +13,7 @@ module Faraday
|
||||
# Doesn't try to encode bodies that already are in string form.
|
||||
class Json < Middleware
|
||||
MIME_TYPE = 'application/json'
|
||||
MIME_TYPE_REGEX = %r{^application/(vnd\..+\+)?json$}.freeze
|
||||
MIME_TYPE_REGEX = %r{^application/(vnd\..+\+)?json$}
|
||||
|
||||
def on_request(env)
|
||||
match_content_type(env) do |data|
|
||||
|
@ -6,8 +6,8 @@ module Faraday
|
||||
# client or server error responses.
|
||||
class RaiseError < Middleware
|
||||
# rubocop:disable Naming/ConstantName
|
||||
ClientErrorStatuses = (400...500).freeze
|
||||
ServerErrorStatuses = (500...600).freeze
|
||||
ClientErrorStatuses = (400...500)
|
||||
ServerErrorStatuses = (500...600)
|
||||
# rubocop:enable Naming/ConstantName
|
||||
|
||||
def on_complete(env)
|
||||
|
@ -25,7 +25,7 @@ module Faraday
|
||||
attr_writer :default_space_encoding
|
||||
end
|
||||
|
||||
ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/.freeze
|
||||
ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/
|
||||
|
||||
def escape(str)
|
||||
str.to_s.gsub(ESCAPE_RE) do |match|
|
||||
@ -37,7 +37,7 @@ module Faraday
|
||||
CGI.unescape str.to_s
|
||||
end
|
||||
|
||||
DEFAULT_SEP = /[&;] */n.freeze
|
||||
DEFAULT_SEP = /[&;] */n
|
||||
|
||||
# Adapted from Rack
|
||||
def parse_query(query)
|
||||
|
@ -29,14 +29,15 @@ SimpleCov.start do
|
||||
minimum_coverage_by_file 26
|
||||
end
|
||||
|
||||
# Ensure all /lib files are loaded
|
||||
# so they will be included in the test coverage report.
|
||||
Dir['./lib/**/*.rb'].sort.each { |file| require file }
|
||||
|
||||
require 'faraday'
|
||||
require 'pry'
|
||||
|
||||
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
||||
# Ensure all /lib files are loaded
|
||||
# so they will be included in the test coverage report.
|
||||
Dir['./lib/**/*.rb'].each { |file| require file }
|
||||
|
||||
# Load all Rspec support files
|
||||
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
||||
|
||||
RSpec.configure do |config|
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
|
Loading…
x
Reference in New Issue
Block a user