mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
added initial implementation (still not working)
This commit is contained in:
parent
815a1177d6
commit
665fd75ea8
33
lib/httpx/plugins/compression/brotli.rb
Normal file
33
lib/httpx/plugins/compression/brotli.rb
Normal file
@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HTTPX
|
||||
module Plugins
|
||||
module Compression
|
||||
module Brotli
|
||||
|
||||
def self_load_dependencies(klass, *)
|
||||
klass.plugin(:compression)
|
||||
require "brotli"
|
||||
end
|
||||
|
||||
def self.configure(*)
|
||||
Transcoder.register "br", BrotliTranscoder
|
||||
end
|
||||
|
||||
module BrotliTranscoder
|
||||
module_function
|
||||
|
||||
def encode(payload)
|
||||
Brotli.encode(payload)
|
||||
end
|
||||
|
||||
def decode(io)
|
||||
Brotli.decode(io)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
register_plugin :"compression/brotli", Compression::Brotli
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user