From cc948bddc058c08ed519c1154d405c8ec0170b5b Mon Sep 17 00:00:00 2001 From: Eric Proulx Date: Sat, 22 Jun 2024 19:31:44 +0200 Subject: [PATCH] Remove Grape::Util::Accept::Header (#2458) * Remove Grape::Util::Accept::Header * Add CHANGELOG.md --- CHANGELOG.md | 1 + lib/grape/util/accept/header.rb | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 lib/grape/util/accept/header.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 8634e36570..4dec503c80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ #### Fixes +* [#3458](https://github.com/ruby-grape/grape/pull/2458): Remove unused Grape::Util::Accept::Header - [@ericproulx](https://github.com/ericproulx). * Your contribution here. ### 2.1.1 (2024-06-22) diff --git a/lib/grape/util/accept/header.rb b/lib/grape/util/accept/header.rb deleted file mode 100644 index 3f6b3a67a9..0000000000 --- a/lib/grape/util/accept/header.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Grape - module Util - module Accept - module Header - ALLOWED_CHARACTERS = %r{^([a-z*]+)/([a-z0-9*&\^\-_#{$ERROR_INFO}.+]+)(?:;([a-z0-9=;]+))?$}.freeze - class << self - # Corrected version of https://github.com/mjackson/rack-accept/blob/master/lib/rack/accept/header.rb#L40-L44 - def parse_media_type(media_type) - # see http://tools.ietf.org/html/rfc6838#section-4.2 for allowed characters in media type names - m = media_type&.match(ALLOWED_CHARACTERS) - m ? [m[1], m[2], m[3] || ''] : [] - end - end - end - end - end -end