dox 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a254b169809b99600afcc0dae0e46f55f6214604ceab941215dee84c48d17af
4
- data.tar.gz: a3172985b3aeeff16496a2b192808c90429519ac79c4ddb2b2a4b36f7cbc21f4
3
+ metadata.gz: 3140e2a29e4bcba21d0eae47f8db211014bd38928f4c6060c61e32f102d75f13
4
+ data.tar.gz: 304610a9e731bd9aefb4dc77999257a3743b762d3447c821a7503be7fa428dbc
5
5
  SHA512:
6
- metadata.gz: e47d00386e96ffb5801fcacbafa0f4885dfb7574cbf458e253f0e88d1a6018de7a4efaff29399653c07b625d26695be4b9110ec87284f1be8224374405f21bd9
7
- data.tar.gz: d0063b18dfe5c953bacd5b226872f4f19e8b2524c90740741d94c33f17557c48285e540695acff22d3a8b118ce845c11f0659b6b38882671c6f73b77710b48eb
6
+ metadata.gz: 9d7a75174e726d53f0d38a8dbdcf96f69ae48a8311245cbe82834c4c6370a862d59b7612ec9ac27694ed10f6eaa7e19391a3373a59851ea0c917cf4d7e657662
7
+ data.tar.gz: 52ddf4123823ca1846e49bfacda241bd5a77c73ea4a0ffc4570e5580d84d47c79844052f64b38de19bf03fd3d3def39ab006cdfa081291a114e46c6e5a0eb497
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.0.2
4
+
5
+ ### Bug fixes
6
+
7
+ - Rewind `rack.input` in `Dox::Formatters::Base` before reading the request body. Rack 3 dropped the implicit rewind on `Rack::Request#body`, so JSON, plain text, and XML request examples were empty when the body had already been consumed during request processing.
8
+ - Guard against a nil request body in `Dox::Formatters::Plain` and `Dox::Formatters::Xml`. Rack 3 returns `nil` instead of `StringIO("")` for bodyless requests.
9
+
10
+ ## v3.0.1
11
+
12
+ ### Bug fixes
13
+
14
+ - Rewind `rack.input` in `Dox::Formatters::Multipart` before re-parsing the request body. Rack 3 dropped the implicit rewind on `Rack::Request#body`, so re-parsing a multipart request whose body had already been consumed by Rails raised `Rack::Multipart::Parser::BoundedIO#read: bad content body (EOFError)` when the formatter ran.
15
+
3
16
  ## v3.0.0
4
17
 
5
18
  ### Enhancements
@@ -4,6 +4,7 @@ module Dox
4
4
  def initialize(http_env)
5
5
  @http_env = http_env
6
6
  http_env_body = http_env.body
7
+ http_env_body.rewind if http_env_body.respond_to?(:rewind)
7
8
  @body = http_env_body.respond_to?(:read) ? http_env_body.read : http_env_body
8
9
  end
9
10
 
@@ -14,9 +14,15 @@ module Dox
14
14
  private
15
15
 
16
16
  def extracted_multipart
17
+ rewind_input
17
18
  Rack::Multipart.extract_multipart(http_env)
18
19
  end
19
20
 
21
+ def rewind_input
22
+ body = http_env.body
23
+ body.rewind if body.respond_to?(:rewind)
24
+ end
25
+
20
26
  attr_reader :http_env
21
27
  end
22
28
  end
@@ -2,6 +2,8 @@ module Dox
2
2
  module Formatters
3
3
  class Plain < Dox::Formatters::Base
4
4
  def format
5
+ return '' if body.nil?
6
+
5
7
  return body if body.encoding == Encoding::UTF_8
6
8
 
7
9
  body.encode(Encoding::UTF_8)
@@ -2,6 +2,8 @@ module Dox
2
2
  module Formatters
3
3
  class Xml < Dox::Formatters::Base
4
4
  def format
5
+ return '' if body.nil?
6
+
5
7
  doc = REXML::Document.new(body)
6
8
  formatter = REXML::Formatters::Pretty.new
7
9
  formatter.compact = true
data/lib/dox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dox
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dox
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melita Kokot
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2026-03-02 00:00:00.000000000 Z
13
+ date: 2026-06-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport