From 1ad0709a755a339ed8ac0e98a213b5b47064f694 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Thu, 27 Aug 2026 23:11:02 +0300 Subject: [PATCH] Validate form encoding before replacing request body state --- lib/net/http/header.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index a39043e..a597182 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -964,13 +964,13 @@ def set_form_data(params, sep = '&') # Field names and values of non-file fields should be encoded with this charset. # def set_form(params, enctype='application/x-www-form-urlencoded', formopt={}) - @body_data = params - @body = nil - @body_stream = nil - @form_option = formopt case enctype when /\Aapplication\/x-www-form-urlencoded\z/i, /\Amultipart\/form-data\z/i + @body_data = params + @body = nil + @body_stream = nil + @form_option = formopt self.content_type = enctype else raise ArgumentError, "invalid enctype: #{enctype}"