Class: HTTPX::Transcoder::Multipart::Decoder
- Inherits:
-
Object
- Object
- HTTPX::Transcoder::Multipart::Decoder
- Includes:
- Utils
- Defined in:
- lib/httpx/transcoder/multipart/decoder.rb,
sig/transcoder/multipart.rbs
Constant Summary collapse
- CRLF =
"\r\n"- BOUNDARY_RE =
/;\s*boundary=([^;]+)/i.freeze
- MULTIPART_CONTENT_TYPE =
/Content-Type: (.*)#{CRLF}/ni.freeze
- MULTIPART_CONTENT_DISPOSITION =
/Content-Disposition:.*;\s*name=(#{VALUE})/ni.freeze
- MULTIPART_CONTENT_ID =
/Content-ID:\s*([^#{CRLF}]*)/ni.freeze
- WINDOW_SIZE =
2 << 14
Constants included from Utils
Utils::FILENAME_EXTENSION_REGEX, Utils::FILENAME_REGEX, Utils::TOKEN, Utils::URIParser, Utils::VALUE
Instance Method Summary collapse
Methods included from Utils
elapsed_time, get_filename, in_ractor?, now, parse_retry_after, to_uri
Instance Method Details
#call(response) ⇒ Hash[String, untyped]
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/httpx/transcoder/multipart/decoder.rb', line 44 def call(response, *) response.body.each do |chunk| @buffer << chunk parse end raise Error, "invalid or unsupported multipart format" unless @buffer.empty? @parts end |