Disable Content-Type header in Rails / Rack -


I am writing a Rail Controller method which gives HTTP 102 (processing):

  However, I get the  Rack :: Lint :: LintError  (via Unicorn): real, status: processing, content_type: zero  

102

  is not allowed  

I have not found any clear way to disable this header. The response to it. Removing the response.content_type by removing them from the hash, in men, , it does not seem to have any effect to pass it as zero in the render option. / P>

I've read that it does not have the tracks which adds the header if it's missing, but the rack.

Or am I better off disabling rack lantling?

Or there is a rack, which is complaining!

Something else I'm missing?

PS: The version I used (1.4.5) has checked the rack source: the content type header has not been added for the status code with an entity body , Which includes all the 1xx status codes according to the rack -1.4.5 / Leib / Rack / UTIsRB . So I do not think this is the rack which is actually adding the headers.

PPS: After several hours of debugging, calls the culprit to the to_a response, which calls Assign_default_content_type_and_charset! Action Pack-3.2.11 / Leash / Action_Dispatch / HT / Answer RB:

  def def_default_content_type_and_charset! [CONTENT_TYPE] back to top Present? @content_type || = Mime :: html @ charset || = Self.clash.default_correct type = @content_type.o_s.dup type & lt; & Lt; "#charset = # {@ charset}" Until the @sending_file header [CONTENT_TYPE] = type end  

It does not seem that I can do this without hacking some infiltration Adding ActionDispatch :: Response to the special purpose midware or monarchy patching action pack.

To fix this, I added a new railway middleware class:

  class RemoveContentType def initialize (app) @app = App end DEF call (NY) status, header, body = @ app.call (Env) # ActionDispatch :: Respondent always inserts content type header # for status code Remove it, which do not allow header .delete ('content-type') if (100..199) .include? (Status.to_i)  application.rb : 

  configured in config.middleware.use [status, header, body] and end  

":: Removalcontent type"

Work for case 102 of my use. Beyond the Tetus code 1xx.


Comments