Skip to content

Commit

Permalink
Revert "Add QueryParser#missing_value for handling missing values +…
Browse files Browse the repository at this point in the history
… tests. (rack#2052)"

This reverts commit 59d9ba9.
  • Loading branch information
jeremyevans committed Mar 16, 2023
1 parent 77f3334 commit be3ea6e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 46 deletions.
1 change: 0 additions & 1 deletion lib/rack.rb
Expand Up @@ -41,7 +41,6 @@ module Rack
autoload :MethodOverride, "rack/method_override"
autoload :Mime, "rack/mime"
autoload :NullLogger, "rack/null_logger"
autoload :QueryParser, "rack/query_parser"
autoload :Recursive, "rack/recursive"
autoload :Reloader, "rack/reloader"
autoload :RewindableInput, "rack/rewindable_input"
Expand Down
15 changes: 3 additions & 12 deletions lib/rack/query_parser.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require_relative 'bad_request'
require 'uri'

module Rack
class QueryParser
Expand Down Expand Up @@ -112,14 +111,6 @@ def normalize_params(params, name, v, _depth=nil)
_normalize_params(params, name, v, 0)
end

# This value is used by default when a parameter is missing (nil). This
# usually happens when a parameter is specified without an `=value` part.
# The default value is an empty string, but this can be overridden by
# subclasses.
def missing_value
String.new
end

private def _normalize_params(params, name, v, depth)
raise ParamsTooDeepError if depth >= param_depth_limit

Expand Down Expand Up @@ -154,7 +145,7 @@ def missing_value

return if k.empty?

v ||= missing_value
v ||= String.new

if after == ''
if k == '[]' && depth != 0
Expand Down Expand Up @@ -216,8 +207,8 @@ def params_hash_has_key?(hash, key)
true
end

def unescape(string, encoding = Encoding::UTF_8)
URI.decode_www_form_component(string, encoding)
def unescape(s)
Utils.unescape(s)
end

class Params < Hash
Expand Down
33 changes: 0 additions & 33 deletions test/spec_query_parser.rb

This file was deleted.

0 comments on commit be3ea6e

Please sign in to comment.