Skip to content

Error on parsing content type header #2276

@mikgry

Description

@mikgry

I’m encountering a NoMethodError when some users send a Content-Type header like application/x-www-form-urlencoded,application/x-www-form-urlencoded. Could you help me identify the cause and resolve the issue?

Exception:

NoMethodError: undefined method 'start_with?' for nil (NoMethodError)

          (str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str

Backtrace:

rack (3.1.8) lib/rack/media_type.rb in block in Rack::MediaType.params at line 37
rack (3.1.8) lib/rack/media_type.rb in Array#each at line 33
rack (3.1.8) lib/rack/media_type.rb in Enumerable#each_with_object at line 33
rack (3.1.8) lib/rack/media_type.rb in Rack::MediaType.params at line 33
rack (3.1.8) lib/rack/request.rb in Rack::Request::Helpers#media_type_params at line 451
rack (3.1.8) lib/rack/request.rb in Rack::Request::Helpers#content_charset at line 459

Corrupted header:

Content-Type: application/x-www-form-urlencoded,application/x-www-form-urlencoded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions