+# Encoding: utf-8
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
def create_connection(&block)
Faraday.new do |b|
+ b.response :charset
b.response :gzip
b.adapter :test do |stub|
stub.get '/', &block
expect(result.body).to eq("Hello world\n")
end
+ it 'should inflate with the correct charset encoding' do
+ conn = create_connection do |env|
+ [200,
+ { 'Content-Encoding' => 'deflate', 'Content-Type' => 'application/json;charset=BIG5'},
+ Base64.decode64('eJxb8nLp7t2VAA8fBCI=')]
+ end
+ result = conn.get('/')
+ expect(result.body.encoding).to eq(Encoding::BIG5)
+ expect(result.body).to eq('日本語'.encode("BIG5"))
+ end
+
describe 'with API Client' do
before do