# How to discover Content-Type in ApplicationController

**URL:** <https://www.ruby-forum.com/t/how-to-discover-content-type-in-applicationcontroller/114085>\
**Category:** Rails\
**Created:** [September 7, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/how-to-discover-content-type-in-applicationcontroller/114085 "2007-09-07T19:14:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gioele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@gioele](https://www.ruby-forum.com/u/gioele)\
**Post date:** [September 7, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/how-to-discover-content-type-in-applicationcontroller/114085/1 "2007-09-07T19:14:56Z")

</div>

How can I discover the Content-Type of the document that is about to be  
outputted by the current request?

I’m inside an after\_filter in ApplicationController. headers{} does not  
contain the Content-Type field when the filter is called.

–  
Gioele

---

<div class="post-metadata">

**Author:** ![gioele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@gioele](https://www.ruby-forum.com/u/gioele)\
**Post date:** [September 7, 2007, 8:12pm UTC](https://www.ruby-forum.com/t/how-to-discover-content-type-in-applicationcontroller/114085/2 "2007-09-07T20:12:31Z")

</div>

Are you using respond\_to in the controller’s action to set the output  
type?

On Sep 7, 1:14 pm, Gioele B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![gioele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@gioele](https://www.ruby-forum.com/u/gioele)\
**Post date:** [September 7, 2007, 8:57pm UTC](https://www.ruby-forum.com/t/how-to-discover-content-type-in-applicationcontroller/114085/3 "2007-09-07T20:57:21Z")

</div>

Hardbap wrote:

> Are you using respond\_to in the controller’s action to set the output  
> type?  
> I’m trying to put this into a plugin, so I don’t know what has been done  
> before. This is why I’m working inside ApplicationController.

–  
Gioele
