mirror of
https://github.com/lostisland/faraday.git
synced 2025-07-16 00:01:45 -04:00
Compare commits
No commits in common. "cc7e7bcea9fbbc0690a5d76b29b25dd9851f5576" and "f77d3a18abe238110878dee95d913861eabca7bc" have entirely different histories.
cc7e7bcea9
...
f77d3a18ab
@ -261,13 +261,14 @@ module Faraday
|
|||||||
# @param headers [Hash, nil] unencoded HTTP header key/value pairs.
|
# @param headers [Hash, nil] unencoded HTTP header key/value pairs.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# conn.put '/products/123', data, content_type: 'application/json'
|
# # TODO: Make it a PUT example
|
||||||
|
# conn.post '/items', data, content_type: 'application/json'
|
||||||
#
|
#
|
||||||
# # Star a gist.
|
# # Simple ElasticSearch indexing sample.
|
||||||
# conn.put 'https://api.github.com/gists/GIST_ID/star' do |req|
|
# conn.post '/twitter/tweet' do |req|
|
||||||
# req.headers['Accept'] = 'application/vnd.github+json'
|
# req.headers[:content_type] = 'application/json'
|
||||||
# req.headers['Authorization'] = 'Bearer <YOUR-TOKEN>'
|
# req.params[:routing] = 'kimchy'
|
||||||
# req.headers['X-GitHub-Api-Version'] = '2022-11-28'
|
# req.body = JSON.generate(user: 'kimchy', ...)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# @yield [Faraday::Request] for further request customizations
|
# @yield [Faraday::Request] for further request customizations
|
||||||
|
@ -61,8 +61,7 @@ module Faraday
|
|||||||
def to_hash
|
def to_hash
|
||||||
{
|
{
|
||||||
status: env.status, body: env.body,
|
status: env.status, body: env.body,
|
||||||
response_headers: env.response_headers,
|
response_headers: env.response_headers
|
||||||
url: env.url
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Faraday
|
module Faraday
|
||||||
VERSION = '2.7.3'
|
VERSION = '2.7.2'
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ RSpec.describe Faraday::Response do
|
|||||||
subject { Faraday::Response.new(env) }
|
subject { Faraday::Response.new(env) }
|
||||||
|
|
||||||
let(:env) do
|
let(:env) do
|
||||||
Faraday::Env.from(status: 404, body: 'yikes', url: Faraday::Utils.URI('https://lostisland.github.io/faraday'),
|
Faraday::Env.from(status: 404, body: 'yikes',
|
||||||
response_headers: { 'Content-Type' => 'text/plain' })
|
response_headers: { 'Content-Type' => 'text/plain' })
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -30,7 +30,6 @@ RSpec.describe Faraday::Response do
|
|||||||
it { expect(hash[:status]).to eq(subject.status) }
|
it { expect(hash[:status]).to eq(subject.status) }
|
||||||
it { expect(hash[:response_headers]).to eq(subject.headers) }
|
it { expect(hash[:response_headers]).to eq(subject.headers) }
|
||||||
it { expect(hash[:body]).to eq(subject.body) }
|
it { expect(hash[:body]).to eq(subject.body) }
|
||||||
it { expect(hash[:url]).to eq(subject.env.url) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'marshal serialization support' do
|
describe 'marshal serialization support' do
|
||||||
@ -46,7 +45,6 @@ RSpec.describe Faraday::Response do
|
|||||||
it { expect(loaded.env[:body]).to eq(env[:body]) }
|
it { expect(loaded.env[:body]).to eq(env[:body]) }
|
||||||
it { expect(loaded.env[:response_headers]).to eq(env[:response_headers]) }
|
it { expect(loaded.env[:response_headers]).to eq(env[:response_headers]) }
|
||||||
it { expect(loaded.env[:status]).to eq(env[:status]) }
|
it { expect(loaded.env[:status]).to eq(env[:status]) }
|
||||||
it { expect(loaded.env[:url]).to eq(env[:url]) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#on_complete' do
|
describe '#on_complete' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user