1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 # Rails handler stack crashes if the request Content-Type header value
6 # is "", which is sometimes the case in GET requests from
7 # ruby-google-api-client (which have no body content anyway).
9 # This middleware deletes such headers, so a request with an empty
10 # Content-Type value is equivalent to a missing Content-Type header.
11 class ClearEmptyContentType
12 def initialize(app=nil, options=nil)
17 if env["CONTENT_TYPE"] == ""
18 env.delete("CONTENT_TYPE")
20 @app.call(env) if @app.respond_to?(:call)
24 Server::Application.configure do
25 config.middleware.use ClearEmptyContentType